Courses / Data Structures and Algorithms
5. Depth-First Search (DFS)
An algorithm for traversing or searching tree or graph data structures, exploring as far as possible along each branch.
Python
Depth-First Search (DFS)
Depth-First Search is a method for exploring all the nodes in a tree or graph by going as deep as possible before backtracking.
"I want to find a path through this maze without retracing my steps."
Depth-First Search (DFS) is an algorithm that traverses a graph or tree structure by exploring one branch fully before moving to the next, using a stack to keep track of nodes.
"I want to find a path through this maze without retracing my steps."
Depth-First Search (DFS) is an algorithm that traverses a graph or tree structure by exploring one branch fully before moving to the next, using a stack to keep track of nodes.