Glossary: Data Structures and Algorithms in Java
DFS (depth-first search)
Also written: depth-first search, DFS
A graph search that goes as deep as possible down one road before backing up to try the next. It finds everything you can reach, often written recursively.
Where the book teaches it
Related terms
BFS (breadth-first search)recursionvisited setBig-O shapes (O(1), O(log n), O(n), O(n log n), O(n²), O(V + E))