Breadth-First-Search

 


Breadth-First Search

A breadth-first search will follow all the possible direction at a same time, taking one step in each possible direction before taking the second step in each direction. The catchphrase you need to remember here is 'first-in-first-out'. 

The opposite of depth-first search algorithm is breadth-first search(BFS).

Pros:

  • This algorithm is guaranteed to find the optimal solution.

Cons:

  • This algorithm is almost guaranteed to take longer than minimal time to run.
  • At worst, this algorithm takes the longest possible time to run.


Comments