AlgoScope

Level Order Traversal

Walk depth by depth with a queue rather than the call stack.

Tree algorithms, algorithm, beginnerAlso called BFS on a tree
Visiting 50, number 1 of 7. The order so far is 50.20304050607080current
Visiting 50, number 1 of 7. The order so far is 50.20304050607080current

Tree Traversals: Level order uses a queue

Decision, step 2 of 9

50 is the root, and level order starts at the top.

How tree traversals works

Cost

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

w is the maximum width.

Leads to

Topics that need this one first.

Taught by the same lesson

Tree Traversals covers these too, in the same run.