DFS Depth First Search | Graph Traversal | Data Structure

Опубликовано: 20 Апрель 2026
на канале: Fit Coder
15,776
324

In this video, I have explained in detail about DFS (Depth First Search). I explained the algorithm as well as the code for DFS.
Depth First Search (DFS) is an algorithm for traversing or searching tree or graph data structures. It starts with the initial node of the graph, and then goes deeper and deeper until we find the goal node or a leaf node. Then the algo backtracks from the dead end towards the most recent node that is yet to be completely unexplored.

Source Code: https://github.com/fit-coder/fitcoder...

00:00 Introduction
00:08 Graph Traversals
00:29 What is DFS ?
04:30 Stack based approach
08:31 Recursive approach
10:27 Applications
13:00 C++ implementation

-------------------------------------------------------------
I live in New Delhi and love explaining programming concepts. I have done M.Tech(BITS Pilani) + B.Tech(PEC, Chandigarh) in Computer Science and am currently working as a software engineer in a MNC.
If you like my content, please like, share my videos and subscribe to the channel.
-------------------------------------------------------------

For in-depth Graph theory and implementation details, please refer to the below videos:
Graphs Introduction -    • Introduction to Graphs Data Structure  

Graph representation:
Adjacency Matrix:    • Graph representation I - Adjacency Matrix ...  
Adjacency List:    • Graph representation II - Adjacency List E...  
Incidence Matrix:    • Graph representation III - Incidence Matri...  

Traversal techniques:
BFS, Breadth First Search:    • BFS Breadth First Search | Graph Traversal...  
DFS, Depth First Search:    • DFS Depth First Search | Graph Traversal |...  

Shortest Path algorithms:
Dijkstra algorithm:    • Dijkstra Algorithm | Single Source Shortes...  
Bellman Ford algorithm:    • Bellman Ford Algorithm | Single Source Sho...  
Floyd Warshall algorithm:    • Floyd Warshall Algorithm | All Pairs Short...  

Minimum Spanning Tree:
Kruskal algorithm:    • Kruskal Algorithm | Minimum Spanning Tree ...  
Prim algorithm:    • Prim Algorithm | Minimum Spanning Tree | G...  

Topological sort (Kahn algorithm):    • Topological Sort | Kahn vs DFS | Graphs | ...  

Articulation points / Cut vertices:
Tarjan algorithm:    • Articulation Points | Cut Vertices | Tarja...  

Disjoint Set / Union Find:    • Disjoint Set | Union Find | Cycle Detectio...  

Maximum Flow Problem:
Ford Fulkerson algorithm:    • Ford Fulkerson Algorithm | Maximum Flow Pr...  

Graph coloring / Chromatic number:    • Graph Coloring | Chromatic Number | BackTr...  

Hamiltonian cycle:    • Hamiltonian Cycle (Circuit) | Hamiltonian ...  

Euler cycle (Fleury algorithm):    • Euler Cycle (Circuit) | Euler Path | Circu...  


#DataStructure,#Graphs,#FitCoder,#Algorithm,#competitiveprogramming