Question

Ex 3: Execute Depth-First Search on the following graphs (starting from node 0) by drawing the recursion tree. Give the temporal order of each recursive call Example 1: DFS(G, 0) 2 DFS(G,9) 6 1 4 9 6 Page 3 of 4

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find your answer below.c Tr SAack max nn o visited o(구 , g A- mank4 -visited. ViS) C3) ㅋ(6) he ol c(sPlease find the solution in to the Image.

DFS:This algorithm traverses a graph in a depthward direction and uses a stack to remember to get the next vertex to start a search, when a dead end occurs in any iteration.

It has following rules:

1.Visit the adjacent unvisited vertex. Mark it as visited. Display it. Push it in a stack.

2. If no adjacent vertex is found, pop up a vertex from the stack. (It will pop up all the vertices from the stack, which do not have adjacent vertices.)

3.Repeat Rule 1 and Rule 2 until the stack is empty .

**Here i have solve the first question but you can solve the second one in a same way only.

Add a comment
Know the answer?
Add Answer to:
Ex 3: Execute Depth-First Search on the following graphs (starting from node 0) by drawing the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT