Understanding level order traversal


Level order traversal is a way of traversing a tree, where we traverse one level at a time (a "level" being all the nodes that sit at the same depth from the root). The nodes in the tree are traversed from top to bottom, from left to right.

Level Order Traversal

Level order traversal follows the following order:

  1. Process level 0 (the root)
  2. Process level 1 (the root's children)
  3. ...
  4. ...

Liking the course? Check our discounted plans to continue learning.