Graph - 10: Find if Source to Destination is reachable in Undirected Graph

preview_player
Показать описание
Solution:
- We'll achieve this via DFS approach.
- Take stack & boolean array
- Now when you start dfs from source index, it mark visited to all components to which it's connected to
- So via visted boolean array, we can identify if element is visited or not
- So at last return visited[destination_index]

Time Complexity: O(V + E)

CHECK OUT CODING SIMPLIFIED

★☆★ VIEW THE BLOG POST: ★☆★

I started my YouTube channel, Coding Simplified, during Dec of 2015.
Since then, I've published over 400+ videos.

★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★

★☆★ Send us mail at: ★☆★
Рекомендации по теме
Комментарии
Автор

Wow, such a wonderful explanation i have never seen how one can simplified one hard concept to very easy

harshgarg
Автор

Great explanation, thank you.Video should have more likes

prashantagrawal
Автор

Great explanation sir.
Can you start the Dijkstra, Prims, Kruskal, Bellman Ford, Floyd warshall too

Khabibullah
Автор

Amazing explanation, thanks! Can you please explain in detail on how to derive space and time complexity for this. Did not understand why it would be O(V+E)

simikaur
Автор

Please make video on kosaraju algorithm for connected components in a directed graph

somyasrivastava
Автор

till now you are describe every in the best way. but your MST video was a little bit confuing

shubhambiswas