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
In assignment, you have already started the process of designing a database for the Beauty Salon mini-case (enclosed again below), mainly in the phase of conceptual database design

Q.1 Write procedures/ Algorithm to insert and delete an element in to array. Q.2. Write an algorithm for binary search. What are the conditions under which sequential search of

Define the terms     i) Key attribute     ii) Value set  Key attribute:  An entity  type  usually  has  an attribute  whose  values  are  distinct  fr

Draw trace table and determine output from the following flowchart using following data: Number = 45, -2, 20.5

Loops There are 3 common ways of performing a looping function: for ... to ... next, while ... endwhile and repeat ... until The below example input 100 numbers and find

how to do a merge sorting

how multiple stacks can be implemented using one dimensional array

Technique for direct search is    Hashing is the used for direct search.

Hear is given a set of input representing the nodes of a binary tree, write a non recursive algorithm that must be able to give the output in three traversal orders. Write down an

Ans: A procedure to reverse the singly linked list: reverse(struct node **st) { struct node *p, *q, *r; p = *st; q = NULL; while(p != NULL) { r =q;