- BFS stands for “
**breadth first search**”. aka Uninformed Search Technique, Blind Search Technique, Bruteforce method. - BFS traverses the tree level wise. i.e.
**each node near to root will be visited first**. The nodes are explored left to right. - Breadth first search is implemented using queue which is
**FIFO**list. - This is a
**single step algorithm**, where the visited vertices are removed from the queue and then displayed at once. - We need to maintain a separate data structure for tracking the tree/graph nodes yet to be visited. This is easily done iteratively using
**Queue data structure**. - BFS always provides the
**shallow path solution**. **No backtracking**is required in BFS.- BFS is
**optimal and complete**if branching factor is finite. - BFS can
**never get trapped into infinite loops**.

**Application of BFS:**

- To find shortest path.
- Single source and all pairs.
- In Spanning tree.
- In Connectivity.

#ai #artificial-intelligence #breadth-first-search #depth-first-search #difference-between

3.90 GEEK