TreesExplained
Morris Traversal
Temporarily link predecessors to walk the tree without a stack.
Time
O(n)
Extra space
O(1)
Use it for
In-order traversal with constant memory.
Temporarily link predecessors to walk the tree without a stack.
Time
O(n)
Extra space
O(1)
Use it for
In-order traversal with constant memory.