Back to Browse

Graph - 4: Depth First Search (DFS) using Adjacency List | Undirected Graph | Directed Graph

27.7K views
Apr 28, 2020
25:00

Source Code:https://thecodingsimplified.com/depth-first-search-traversal-dfs-using-adjacency-list/ Solution: - We'll take stack & boolean array - We'll put starting index in stack & mark true for this index - Now we'll poll top element from stack & fetch list for index. This'll show all neighbours connected to this index - Now we'll add all elements which are not visited & insert into stack - Do above until stack is not empty Time Complexity: O(V + E) Space Complexity: O(V + E) CHECK OUT CODING SIMPLIFIED https://www.youtube.com/codingsimplified ★☆★ VIEW THE BLOG POST: ★☆★ http://thecodingsimplified.com I started my YouTube channel, Coding Simplified, during Dec of 2015. Since then, I've published over 400+ videos. ★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★ https://www.youtube.com/codingsimplified?sub_confirmation=1 ★☆★ Send us mail at: ★☆★ Email: [email protected]

Download

0 formats

No download links available.

Graph - 4: Depth First Search (DFS) using Adjacency List | Undirected Graph | Directed Graph | NatokHD