kopia lustrzana https://github.com/animator/learn-python
Update linked-list.md
rodzic
53de9d4124
commit
20d36f661b
|
@ -168,8 +168,8 @@ check the list is empty otherwise shift the head to next node.
|
|||
while(temp):
|
||||
nextNode = temp.next #Store the next node
|
||||
temp.next = prev # Reverse the pointer of current node
|
||||
prev = temp #Move `prev` one step forward
|
||||
temp = nextNode #Move `temp` one step forward.
|
||||
prev = temp # Move prev pointer one step forward
|
||||
temp = nextNode # Move temp pointer one step forward.
|
||||
self.head = prev # Update the head pointer to last node
|
||||
```
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue