Skip to content

Glossary: Coding Interviews in Java

DFS (depth-first search)

Also written: DFS, DFS flood fill

A search that follows one path as far as it can, usually by recursion, before backing up. It is used, for example, to mark every cell of a connected shelf block in a grid.

Where the book teaches it

Related terms

Flood fillIslandCall stackBFS (breadth-first search)