Commonly Compared

Breadth-first search

vs

Here’s the Deal

Slant is powered by a community that helps you make informed decisions. Tell us what you’re passionate about to get your personalized feed and help others.

#### Ranked in these QuestionsQuestion Ranking

#### Pros

### Pro Complete

BFS is complete, which means that it will always find a solution if it exists.

### Pro Optimal for finding the shortest path in a graph

BFS is very useful when you want to find the shortest and most optimal path by traversing as few edges as possible.

#### Cons

### Con Requires a large amount of memory

When traversing one tree level, you need a way to know which nodes to traverse once you get to the next one. The way this is done is by storing the pointers to a level's child nodes while searching it. The pointers are stored in a FIFO way, this means that BFS needs a relatively large amount of memory in order to store the pointers. The amount of course depends on the complexity of the graph tree and the amount of nodes and/or levels.

#### Commonly Compared

Breadth-first search

vs

#### Alternative Products

Built By the Slant team

Find the best product instantly.

Lustre recommends the best products at their lowest prices – right on Amazon.

4.7 star rating

Try it now - it's free