Find if Path Exists in Graph | DFS Python

preview_player
Показать описание
Link to question:
Time: O(V) = # of vertex
Space: O(V + E) = #of vertex +# of edge → adjacency list
Рекомендации по теме
Комментарии
Автор

Really nice solution! Thank you! A quick question: when do you return false?

potatocoder
Автор

Thank you so much for sharing this video Emily. Could you please let me know how exactly DFS plays its part? In your BFS video I got the clear idea of queue where it goes layer by layer and then after next layer is processed. But here I am not getting idea of how DFS is working.

krishnajoshi