Graph - 5: Breadth First Search (BFS) using Adjacency List | On Undirected Graph | On Directed Graph

preview_player
Показать описание
Solution:
- We'll take queue & boolean array
- We'll put starting index in queue & mark true for this index
- Now we'll poll one element from queue & 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 queue
- Do above until queue is not empty

Time Complexity: O(V + E)
Space Complexity: O(V)

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: ★☆★
Рекомендации по теме
Комментарии
Автор

your "hey everyone" in the intro has got my roommates thrilled and they say hey everyone all the time now. We love your energy!

rheashajan
Автор

Thank you so much!!!! I'm from Bangladesh... I am glad to find this channel. Highly recommended

PetBuddies
Автор

Keep up the good work man. Need more videos on graphs😃

ClashWithSwap
Автор

best bfs on adjacency list explanation! thanks

darrenhorwitz
Автор

Very good work sir
Please we need more videos on graphs please make more videos fast👃🏻👃🏻👃🏻

AyushKumar-vhpg
Автор

Amazing man! Im your Huge huge fan! Can you please help us in finding some larger roots of a large number in java and also how to effectively calculate large powers of a number. Please sir! I will really appreciate it. Thanx and regards.

coolsid