AlgoScope

Level Order Traversal

AlgorithmbeginnerTree Traversalsalso called BFS on a tree

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

Decision · step 2 of 9Tree Traversals: Level order uses a queue
20304050✓607080current

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

Open in the player →or start at step 2

What you will see

A queue beside the tree; each dequeued node enqueues its children; levels light up in bands.

How tree traversals works →

Cost

BestO(n)
AverageO(n)
WorstO(n)
SpaceO(w)

w is the maximum width.

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next, try operations in any order.

Screen readers: Nodes announce value, left child and right child; each step announces the comparison and the direction taken or the structural change.

Reduced motion: Focus jumps node to node with a static ring; rotations become a crossfade between the two layouts.

Before this

Leads to

Topics that need this one first.