Skip to content

Glossary: Data Structures and Algorithms in C++

Depth-first search (DFS)

Also written: DFS, depth-first search

A graph search that goes as far as possible down one road before backing up, written with recursion or a stack. It finds everything reachable from a place.

Where the book teaches it

Related terms

Breadth-first search (BFS)visited setRecursion