We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9114a59 commit 928b780Copy full SHA for 928b780
src/main/java/com/algorithm/study/demo/algorithm/Jianzhi02.java
@@ -79,10 +79,14 @@ public void printListInverselyUsingIteration() {
79
*单链表反转
80
*/
81
public ListNode reversalNode(){
82
+ //当前节点的上一个节点
83
ListNode previousNode = null;
84
+ //当前节点
85
ListNode currentNode = root;
86
+ //返回反转后的节点
87
ListNode headNode = null;
88
while (currentNode != null) {
89
+ //当前节点的下一个节点
90
ListNode nextNode = currentNode.next;
91
if (nextNode == null) {
92
headNode = currentNode;
0 commit comments