• + 0 comments
    def reverse(llist):
        reverse, stack, current = SinglyLinkedList(), [], llist
        while current:
            stack.append(current.data)
            current = current.next
        while stack:
            reverse.insert_node(stack.pop())
        return reverse.head