The only people who have anything to fear from free software are those whose products are worth even less. David Emery

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.