(Remade) Dijkstra's Algorithm | BFS | Network Delay Time | Leetcode 743

preview_player
Показать описание
Topic: Dijkstra | Breadth First Search
Time Complexity: O(ElogE)
Space Complexity: O(V + E)

Code:

Leetcode:

*Note* I claim no rights to this question. All rights belong to Leetcode. If I'm reviewing a solution that was from another Leetcode user or Leetcode itself I will give credit below.

Hey there! Just wanted to let you know that some of the below links in this video description are affiliate links, which means that if you make a purchase through them, I may earn a small commission. Don't worry though, it doesn't cost you anything extra and it helps support this channel so I can continue to make more videos for you. Thank you so much for your support, and as always, all opinions are my own!

Рекомендации по теме
Комментарии
Автор

Thanks for your videos! Just want other viewers to know that there is no need to compare the res with Math.max, because pq polls all possible distances strictly from the smallest to the biggest. So each time you update res, res would be bigger. And in the end, res would be automatically the biggest, which is the longest time you need to access all nodes ;)

kangniliu
Автор

0:00 Outline
0:21 Input/Output
1:39 BFS vs Dijkstra
4:38 Dry Run
8:34 Algo Visualizer
9:00 Code
11:20 Time/Space Complexity


I made a mistake by writing 742 on the top, I meant to write 743

Hey there! Just wanted to let you know that some of the links in this comment are affiliate links, which means that if you make a purchase through them, I may earn a small commission. Don't worry though, it doesn't cost you anything extra and it helps support this channel so I can continue to make more videos for you. Thank you so much for your support, and as always, all opinions are my own!

NideeshTerapalli
Автор

Great video, please keep up the good work. The animation in the end was good.

Nickel
Автор

amazing video bro!! Cleared all the confusions and made it so much more inuitive

abhinavsinghal
Автор

Great explanation. I could visualize the whole thing easily.

chepaiytrath
Автор

increase font size on white board. It is hard to read even in HD

kirtanitaliya
Автор

I think
dist.put(K, 0); // should be commented. and also

max = Math.max(max, dis); // should go after `if (dist.containsKey(node)) {continue;}` and before `if (adj.containsKey(node))`
correct me if I'm wrong

EaimanShoshi
Автор

are you indian ?? but you don't sound like indian .. very different accent

satishshingade
welcome to shbcf.ru