Level-Order Traversal
overview
Summary
level_order_traversal visits tree nodes level by level. It is a breadth_first_search starting at the root. Use a queue: enqueue the root, then repeatedly dequeue a node, record its value, and enqueue its children. Nodes are processed left_to_right within each level. The result can be a flat sequence or per level groups. Complexity: O_n_time for n nodes; space matches the widest level, worst case O_n_space. Remember: queue, level by level, left to right.