You are viewing a single comment's thread. Return to all comments →
python3
class Node: def __init__(self,data): self.data=data self.next=None class SinglyLinkedList: def __init__(self): self.head=None def insert_node(self,data): node=Node(data) node.next=self.head self.head=node def reverse(head): return head
Seems like cookies are disabled on this browser, please enable them to open this website
Reverse a linked list
You are viewing a single comment's thread. Return to all comments →
python3