The goal of Computer Science is to build something that will last at least until we have finished building it. Anonymous

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?



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



No comments available!

Please login to add comments.