Level-Order BFS
Queue-driven traversal one level at a time.
This animation shows breadth-first search sweeping a tree level by level, driven entirely by the queue strip at the bottom.
Each level lights up in its own hue, in order: the root alone, then depth 1, then depth 2. Watch the queue choreography that makes it happen — a node leaves the front of the queue exactly when it is processed, and at that moment its children join the back. First in, first out is the whole mechanism: because parents entered before children, no child can ever be processed before any node of the level above it.
The subtle detail to watch is the level boundary. Before each level is drained, the animation marks the current queue length — say, 2 nodes. Exactly that many dequeues form the level; the children arriving at the back during those dequeues belong to the next level and wait behind the marker. That size snapshot is the one line that separates "visit everything in BFS order" from "give me each level as its own list".
Toggle right-side-view mode and watch only the last node of each level get highlighted — that is the entire Right Side View algorithm riding on the same loop. Note also how wide the queue gets at the bushiest level: BFS's memory cost is the widest level, not the height.