Question

3. Consider the following graph and identify the sequence of nodes visited when employing both breadth and depth-first search

*** NOTE to EXPERT: Please use both breadth and depth-first searching strategy to find a route from 1-11 ***

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Using DFS (Depth first search)

In dfs, we look at a child node first, then the child node of that node and so on until we reach a terminal node.

For example,  the root node is 1, then a child node of that is 2, then a child node of that is 5, then 9. Since 9 is terminal, we go back to its parent (5) and go through more children nodes.

1, 2, 5, 9, 10, 6, 10, 3, 4, 7, 12, 8, 11

Using BFS (Breadth first search)

For bfs, we look at all the children nodes ofor the root node, then all of their children nodes, and so on.

So we start with 1. It's children nodes are 2,6,3,4. Then their children nodes are re 5,10,7,8 and so on.

1, 2, 6, 3, 4, 5, 10, 7, 8, 9, 10, 12, 11

Comment below for any enquiries

Please leave a thumbs up
Add a comment
Know the answer?
Add Answer to:
*** NOTE to EXPERT: Please use both breadth and depth-first searching strategy to find a route...
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