Depth first traversal, Data Structure & Algorithms

A depth-first traversal of a tree visits a nodefirst and then recursively visits the subtrees of that node. Similarly, depth-first traversal of a graph visits a vertex and then recursively visits all the vertices adjoining to that node. The catch is that the graph may contain cycles, but the traversal must visit each vertex at most once. The solution to the problem is to keep track of the nodes that have been visited, so that the traversal does not experience the fate of infinite recursion.

 

 

Posted Date: 7/10/2012 3:36:16 AM | Location : United States







Related Discussions:- Depth first traversal, Assignment Help, Ask Question on Depth first traversal, Get Answer, Expert's Help, Depth first traversal Discussions

Write discussion on Depth first traversal
Your posts are moderated
Related Questions
Worst Fit method:- In this method the system always allocate a portion of the largest free block in memory. The philosophy behind this method is that by using small number of a ve

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

algorithm for multiplication of two sparse matrices using linked lists..

ST AC K is explained as follows : A stack is one of the most usually used data structure. A stack is also called a Last-In-First-Out (LIFO) system, is a linear list in

One of the main problems with the linear queue is the lack of appropriate utilization of space. Assume that the queue can store 100 elements & the complete queue is full. Thus, it

Optimal solution to the problem given below. Obtain the initial solution by VAM Ware houses Stores Availibility I II III IV A 5 1 3 3 34 B 3 3 5 4 15 C 6 4 4 3 12 D 4 –1 4 2 19 Re

1. Give both a high-level algorithm and an implementation (\bubble diagram") of a Turing machine for the language in Exercise 3.8 (b) on page 160. Use the ' notation to show the co

QUESTION (a) Construct a binary tree for the following numbers assuming that a number greater than the node (starting from the root) goes to the left else it goes to the right.

write an algorithm and draw a flowchart to calculate the perimeter and area of a circle

ALGORITHM (Insertion of element into a linked list) Step 1 Begin the program Step 2 if the list is empty or any new element comes before the start (head) element, then add t