Skip to content

Glossary: Coding Interviews

DFS (depth-first search)

Also written: DFS, DFS flood fill

A search that follows one path as far as it can before backing up, usually written with recursion. Here it marks every cell of an island as visited.

Where the book teaches it

Related terms

Flood fillIslandRecursionErrorBFS (breadth-first search)