menu_book Course Curriculum (Data Structures & Algorithms) expand_more
Complexity & Foundations
Arrays & Strings
Linked Lists
Stacks & Queues
Hashing
Trees & Heaps
Graphs
Reverse linked list
Learn Reverse linked list in Data Structures & Algorithms with a focused explanation, a topic-specific example, edge guidance, and a mastery check.
12 min read
•
Beginner
data-structures-algorithms-024.py
python
class Node:
def __init__(self,v,n=None): self.v,self.next=v,n
head=Node(1,Node(2,Node(3))); prev=None
while head:
nxt=head.next; head.next=prev; prev=head; head=nxt
print(prev.v,prev.next.v,prev.next.next.v)
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content