【发布时间】:2016-02-21 21:22:33
【问题描述】:
我只是想知道以下是否是删除链表中特定位置的节点的正确方法。
So if my "target" node is located between the head and the tail (middle): 1. set a "curr" node equal to the head 2. Iterate using "curr = curr.next" until curr.next = "target" 3. set curr.next = curr.next.next If my target is located at the tail I do: 1. set "curr" node equal to the head 2.Iterate until curr.next.next = null 3. set curr.next = null
我也很难理解如何更改我设置为“head”的“curr”节点可以修改与“head”关联的实际链表,而不仅仅是附加到“curr”的链表。
谢谢你,我真的需要帮助:)
【问题讨论】:
标签: java pointers linked-list nodes