Skip to content

Glossary: Coding Interviews

BFS (breadth-first search)

Also written: BFS, BFS on a grid, breadth-first search

A search that explores a grid or graph one step at a time using a queue, so the first time it reaches the goal is by the fewest steps. It is the pattern for shortest-path questions on a map.

Where the book teaches it

Related terms

dequeGridDFS (depth-first search)