Data Structures & Algorithms

Depth-First Search

/depθ fɜːst sɜːtʃ/

Definition

A graph traversal following edges as deep as possible before backtracking — uses a stack or recursion.

Example in context

"DFS is used to detect cycles in a dependency graph — if you revisit a node on the current path, there's a cycle."

Related terms

Practice this term

Master Depth-First Search in context by working through exercises in the Data Structures & Algorithms module. You'll see the term used in real engineering scenarios with multiple-choice, fill-in-the-blank, and matching drills.