This post is completed by 4 users

  • 0
Add to List

151. Breadth-First Search/Traversal in a Binary Tree

Breadth-First Search ( or Traversal) is also known as Level Order Traversal.

What is Breadth First Search:

Breadth-first search (BFS) is an algorithm for traversing or searching tree or graph data structures. It starts at the tree root and explores the neighbor nodes first, before moving to the next level neighbors. (Reference - Wiki)



  1. Take an Empty Queue.
  2. Start from the root, and insert the root into the Queue.
  3. Now while Queue is not empty,
    1. Extract the node from the Queue and insert all its children into the Queue.
    2. Print the extracted node.


Breadth First Search :
 5 10 15 20 25 30 35