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.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% 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.