You are viewing a single comment's thread. Return to all comments →
def reverse(llist): head = llist last = None # hold onto last visited note while head: tmp = head.next head.next = head.prev head.prev = tmp last = head head = tmp return last
Seems like cookies are disabled on this browser, please enable them to open this website
Reverse a doubly linked list
You are viewing a single comment's thread. Return to all comments →