Dijkstra’s Algorithm for Coding Interviews | Single Source Shortest Path (Greedy Algorithm)

preview_player
Показать описание
We'll cover everything you need to know about Dijkstra's algorithm for your coding interview.
Dijkstra is a very important graph algorithm.
It is a greedy algorithm used to find the shortest path from a single source node to all other nodes in a graph.
In this video, we’ll learn when to use Dijkstra, how Dijkstra works (with pseudo code, actual code and an example walk through) and we’ll finish with a space & time complexity analysis.
Dijkstra can be used to solve a variety of coding interview questions.
We’ll use the algorithm and code we write in this video in the next one, to solve 2 LeetCode coding questions.
Рекомендации по теме
Комментарии
Автор

The best Dijkstra’s Algorithm explanation I've ever seen so far! Thanks so much for making this video possible! I was struggling a lot with understanding this algorithm properly. You make it look a lot easier!

felidev
Автор

0 : 33 Girl, ur Cities sound like CDs or compact Discs 😅🤣In fact the vertices of the graph used in the image look more of blue discs or CDs to me 😂

yogeshdharya
Автор

I am already done. But, I always try see your video because you make more as much as possible visualization and walk through code.
I am waiting for more content related to DSA.

kapilvaishnav
Автор

it is guaranteed that when a node a poped we already have the best path cost for it. so why in the algorithm are we checking for "if not visited[nextNode] and nextDist < dist[nextNode]" we can simply just check "if nextDist < dist[nextNode]"

ritwickjha
Автор

Short, concise, and to-the-point videos, are very easy to understand. Thanks for the amazing content.

akshaykulkarni
Автор

You have a lot of speed and I had to slow down video sometimes to see what is happening! Great explanation especially of the time and space complexity

charleskorey
Автор

Best explanation and code walk-through ever! You are excellent in this! Thanks and please continue making more videos ^^

銨老孫
Автор

One of the best explanations of Dijkstra's along with its implementation that I've seen. Good work!

stevenzeng
Автор

Thanks for the video.
Also, Could u plz take up this problem?
Cheapest flight with k stops
(I'm getting TLE with normal bfs approach )

ashokk
Автор

Thats the wieredest way I have seen anyone write the "1" number

whynesspower
Автор

Hey shiran please try to make more videos also just 2-3 videos in past 4 months 😞😞

MilindGupta
Автор

Excellent explanation. So easy to understand. Thank you so much.

aadityakiran_s
Автор

Very well explained and structured. Thank you for the video.

BogdanHladiuc
Автор

Hello Shiran, one thing I don't understand is why do you check for visited nodes when you Pull a Node from the Queue, BFS dictates that all Nodes that are added to the Queue have not been visited yet; and therefore you mark them as visited at the moment you Add them to Queue. Would you mind explaining this difference?

jlecampana
Автор

Great explanation, thank you, Pls continue making such videos...

rohalkurup
Автор

Subscribed! What an explanation! You made it looked a lot easier. Thanks.

MichaelOnyeforo
Автор

If possible can u make video on linesweep I am saying because there are not good videos on it

tombrady
Автор

You mentioned that you included tests, etc.
How can we access them?

BlumChoi
Автор

what kind of drawing tablet + software do you use for your presentations? they are quite fantastic and want to pick somethin up for mock interviews

TheAidsaids
Автор

Amazing explanations! Thank you and keep up the great work!

babacargadiaga