Hi all,
I built my own Linked List class in java.
each element in the list is of type Node (has next and prev)
However, when I'm trying to remove an element from the list I create a node and assign it to my head Node (the first element in the list)
This is what I'm doing in order to search for the specific element I want to remove.
My question is:
How come 'head' does not change every-time I change tmp.
It just doesn't make any sense to me.
Thanks a lot,
Tal
I built my own Linked List class in java.
each element in the list is of type Node (has next and prev)
However, when I'm trying to remove an element from the list I create a node and assign it to my head Node (the first element in the list)
This is what I'm doing in order to search for the specific element I want to remove.
Node tmp = head.next;
while(tmp != null && tmp.data != obj){
tmp = tmp.next;
}
My question is:
How come 'head' does not change every-time I change tmp.
It just doesn't make any sense to me.
Thanks a lot,
Tal