In this tutorial, you will learn Depth First Search which is also known as the DFS algorithm. It is another algorithm like BFS. Unlike the BFS algorithm where we traverse the graph breadth-wise, in the DFS algorithm, we traverse the graph depth-wise, hence the name, depth-first search. DFS will continue visiting nodes until it arrives at a node with no unvisited adjacent nodes. So let's begin.
Depth First Seach (DFS) algorithm tutorial:
DFS algorithm is a recursive algorithm that involves the idea of backtracking. The term backtrack means we move along the path and if there is no node to visit along the current path we move backward on the same path and then find other nodes to traverse. All the nodes of the current path will be visited after which the following path will be selected.
https://www.cstutorial.org/data-structure/depth-first-search-dfs-algorithm-tutorial
Top comments (0)