0% found this document useful (0 votes)
89 views

DFS and BFS Quiz

Depth First Search would visit City A, then the deepest city connected which is City H, before returning and visiting cities in between. Breadth First Search would visit City A, then all adjacent cities (B, C, D) before going further, ensuring all neighbors of a city are explored before moving deeper.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views

DFS and BFS Quiz

Depth First Search would visit City A, then the deepest city connected which is City H, before returning and visiting cities in between. Breadth First Search would visit City A, then all adjacent cities (B, C, D) before going further, ensuring all neighbors of a city are explored before moving deeper.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Using Depth First Search and Breadth First Search, show how you can visit all the 9 cities starting from City A up
to City H.

A. Depth First Search

B. Breadth First Search

You might also like