You are viewing a single comment's thread. Return to all comments →
Recursive approach
def reverse(llist, prev=None): if llist is None: return prev temp = llist.next llist.next = prev prev = llist return reverse(temp, prev)
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 →
Recursive approach