Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. Linus Torvalds

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.



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



Please login to add comments.