Depth First Search
Last updated
What is Depth First Search?
Depth-First Search (DFS) is an algorithm used for traversing or searching tree or graph data structures. The process starts at the root node (selecting some arbitrary node as the root in the case of a graph), and explores as far as possible along each branch before backtracking. It uses a last in, first out (LIFO) stack to remember to get the next vertex to start a search when a dead end occurs in any iteration. DFS has been used in a variety of applications including finding connected components, topological sorting, and finding articulation points (or cut vertices) in a graph.
Free resources to learn Depth First Search
More in stage 11: Advanced Data Structures
- Advanced Data Structures
- Trie
- Segment Trees
- Fenwick Trees
- Disjoint Set (Union-Find)
- Suffix Trees and Arrays
- Binary Trees
- Tree Traversal
- Search Algorithms
- Binary Search Trees
- In-Order Traversal
- Breadth First Search
- AVL Trees
- Pre-Order Traversal
- Depth First Search
- B-Trees
- Heap
- Post-Order Traversal
- Search Algorithms
- Breadth First Search
- Shortest Path Algorithms
- Dijkstra's Algorithm
- Bellman-Ford Algoritm
- A* Algorithm
- Minimum Spanning Tree
- Prim's Algorithm
- Kruskal's Algorithm
Depth First Search: common questions
Can I learn Depth First Search in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Depth First Search in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this Depth First Search tutorial for beginners?
It is lesson 72 of 107 in the free Data Structures & Algorithms roadmap, in stage 11, Advanced Data Structures. If you are new to Data Structures & Algorithms, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.