Skip to content
Treesintro

Pre-order Traversal

Visits the node first, then its left and right subtrees. Pre-order produces a serialisation from which the tree can be rebuilt, and mirrors how you would clone or print a tree top-down.

Best
O(n)
Average
O(n)
Worst
O(n)
Space
O(h)