user7025954
user7025954

Reputation:

What is node, node.next and node.next.next in linked-list.?

I am just curious about node . node.next and node.next. Until now we have read that node has two part in which it store data and address of next node(node.next) then whats about node.next.next. ? Where the address of node.next.next will be stored. I just implemented node.next.next to delete a number from the end of list. Its working well. Butt i don't know about node.next.next?? please help me in understanding of concept of nodes. Here is code in which i implemented node.next.next.

public void del_`enter code here`end(){
        Node temp = head;
        while(temp.next.next!=null ){
            temp= temp.next;
        }
        temp.next= null;

}

Upvotes: 2

Views: 22904

Answers (1)

Pavneet_Singh
Pavneet_Singh

Reputation: 37404

node = current node

node.next = next node to current

node.next.next = 2nd node from current node

enter image description here

little more explanation about how's your logic work

enter image description here

Upvotes: 7

Related Questions