Considering the current sad state of our computer programs, software development is clearly still a black art, and cannot yet be called an engineering discipline. Bill Clinton

Depth First Search

Language Java | Level Intermediate | Category Data structure | September 17, 2015 3:06 am


Data structure Description

Depth First Search algorithm is an algorithm to search node from tree or graph. DFS algorithm starts traversing from the root. It traverses each branch before backtracking. DFS takes less memory compared than Breadth first search and not necessary to store all of the child pointers at each level.

The major drawback in depth-First Search is not guaranteed to find the solution. If it finds the solution, it may not be minimal solution.

Write a program to implement depth first search using the graph?


Output

   					 

Visits from source to destination using DFS: A->B->C->D->E

				    

Comments


No comments available!

Please login to add comments.