Question

3. Show the BFS& DFS traversal order of the following graph 4 BFS Traversal Order: GFE DCE DFS Traversal Order 4. Given a 0/1 Knapsack of 5 objects, (Capacity M=11), value-6, 4,7, 2, 3), weig 4 36. 1 Snecify the highest yaluel combination of objects that can fit in the
0 0
Add a comment Improve this question Transcribed image text
Answer #1

ANSWER:-

BFS:- Traversal order ABCDEFG (take source vertex A)

Explanation:- use queue and find the breadth first search . in queue push first vertex

and pop first vertex and push all vertex which is adjacent from pop vertex . again pop front vertex of the queue and push all adjacent vertex from pop vertex this process continue untill queue is empty.

DFS:- Traversal order ABCDFEG ( take source vertex A)

Explanation:-

use stack and find the depth first search . in stack push first vertex  

and scan all vertex which is adjacent from top vertex of stack and push one vertex which is adjacent from top vertex(unvisited) . again scan all vertex which is adjacent from top vertex of stack and push one adjacent vertex which is adjacent from top vertex (unvisited). this process continue untill all vertex visited

// please thumb up.

Add a comment
Know the answer?
Add Answer to:
3. Show the BFS& DFS traversal order of the following graph 4 BFS Traversal Order: GFE...
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