Skip to content

Glossary: Coding Interviews in C++

BFS (breadth-first search)

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

A search that explores all cells one step away, then two steps away, and so on, using a queue. It finds the fewest steps between two cells, such as across the warehouse floor.

Where the book teaches it

Related terms

Gridstd::queueDFS (depth-first search)