#Linked list question

1 messages · Page 1 of 1 (latest)

vital oceanBOT
#

<@&987246399047479336> please have a look, thanks.

twilit tinsel
#

ig it deletes the node x

#

but theres no option for that

faint pawn
#

We haven't assigned to first or to any field in a node connected to the list.

We've discarded the new node that t was pointing to, by assigning t to a node in the list (the one after the node originally referred to by x).

We've then move x along one position by assigning to match t.

But the list hasn't changed. We never used the new node, and x isn't part of the list, it's just a reference into it.

sweet vale
#

we pointed the x to t which should delete the res of the nodes

#

(im not sure, need to revise this thing again)

faint pawn
#

x is just a variable, not the owner of the list. You can have as many references into the list as you like, it doesn't change the list itself.

#
String s = "example";
String t = s; // this doesn't change 's' at all. They both now refer to the same String instance.
twilit tinsel
#

yea ig it'll be "does nothing to the list"

sweet vale
twilit tinsel
#

yes