Depth First Search Algorithm

Depth-first search (DFS) algorithm is an algorithm for traversing or searching tree or graph data structures. One starts at the root (selecting some arbitrary node as the root in the case of a graph) and explores as far as possible along each branch before backtracking. **DFS is one of the most useful graph algorithms.**

The average case time complexity is O(V+E) and the auxiliary space complexity is O(V)

Refer the article for more details and implementations.

Share your thoughts or ask any questions below.
This is a companion discussion topic for the original entry at