If McDonalds were run like a software company, one out of every hundred Big Macs would give you food poisoning, and the response would be, ‘We’re sorry, here’s a coupon for two more.’ “ Mark Minasi

Depth-first recursive search in a tree

Language Java | Level Intermediate | Category Algorithms | August 3, 2015 9:48 pm


Algorithm Problem Description

Graph and tree nodes can be traversed using the backtracking technique. Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. DFS takes less memory compare than Breadth-first search and not necessary to store all of the child pointers at each level.

DFS technique used in web-crawling, Finding connected components, Topological sorting, Finding the bridges of a graph, Finding strongly connected components, Solving puzzles with only one solution, such as mazes, maze generation may use a randomized depth-first search, Finding connectivity in graphs.

Output

          	        
          	        

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

          	        
          	        				    


Comments



Please login to add comments.