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

前提是你 提交于 2019-12-19 11:05:26

问题


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;

}

回答1:


node = current node

node.next = next node to current

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

little more explanation about how's your logic work



来源:https://stackoverflow.com/questions/40566549/what-is-node-node-next-and-node-next-next-in-linked-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!