Skip to content
StackDecode
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.

An animated walkthrough for this algorithm isn’t built yet. The summary above explains the idea; see the related animated algorithms below to practise the same technique.