Skip to content

Glossary: Data Structures and Algorithms in JavaScript

Depth-first search (DFS)

Also written: DFS, depth-first search

A graph search that goes as far as it can down one road before backing up to try the next. It finds everything reachable and can be written with recursion or a stack.

Where the book teaches it

Related terms

Breadth-first search (BFS)Recursionvisited set