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