Dijkstra algorithm | Code implementation

preview_player
Показать описание
This video explains the implementation with code for the dijkstra algorithm which is also known as the single source shortest path algorithm.In this video, I have first shown the steps for the algorithm and then i have analyzed what data structures are required to find the shortest path from the source node to every other node or vertex.I have taken the simple implementation for easier understanding using arrays.You can implement using SET or MAP as well.I have shown dry run for an example and at the end of the video, i have shown the code walk through and explanation.CODE LINK is present below as usual. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)

========================================================================
Join this channel to get access to perks:

=======================================================================

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

Awesome explanation.. it would be better if u could show the implementation using priority queue and adj list

PiyushKumarPorwal
Автор

this is the only video on youtube of Dijkstra algorithm which explains as well as implement the algorithm.
Very well explained . Helpful for the many tier 3 college students.

princebhati
Автор

I like how you always say "I hope you are understanding this." I am understanding this :)

rachellee
Автор

Additional note to the video:
SSSP in a directed acyclic graph can be found in O(V+E) by finding topological sort ordering of the graph.

manikantabandla
Автор

Thank you so much for the video. It helps me to understand this algorithm better!

chenghuilee
Автор

Excellent ! how neat and superb explaination it was with proper examples and dry run.

mayurkapadnis
Автор

Exactly what i was looking for. Thank you sir.

kumarpriyansh
Автор

I think it is best explanation on youtube on this topic, it is awsm

mayank_singh_
Автор

Thanks for creating this series of videos. Can you please add LLD and HLD playlist or point to some good resources for them.

chinmoybhattacharya
Автор

Wow 😊 beautiful video everything very clear in this video.. thanking you so much sir ❤️😍😇

kunalsoni
Автор

God Bless you, man! So there is only 1 line of difference in code between PRIMS and Dijkstra!

rishabhgoyal
Автор

Thanks...
Simple and clear explanation.

ajitbombe
Автор

i appreciate your work..a very very thank you sir.

rishabhkumar
Автор

just went to your website, feels good to know that you are a fellow shinobi

anushrut
Автор

Thanks so much for the video. Among other videos on youtube on Dijkstra's algorithm this was the best.
Can you please answer if the algorithm works (without any modification) even if more than one unprocessed nodes are minimum cost at any iteration?

aishikroychaudhury
Автор

can we just take a queue and only push to it if the value of vertex is updated, we can skip the visited array and looping through all vertices thing right?

JSDev
Автор

Good explanation, But I want to see how we can use heap(priority_queue) for optimization version because during updation of distance we can't update it directy in heap(priority_queue) . There is no decrease key operation available in priority queue.
For this we have to define our own min_heap with some some changes. So if you have solution then please ans it so we can use priority_queue.

bhaveshvarma
Автор

Hey Buddy, very nice explanation. Can I know what do you use to write and record?

KshitijJain
Автор

What kind of traversal is better for this algorithm ? Dfs or bfs

priyanshugupta
Автор

Very nice explanation! Thanks! one small doubt, using the adjacency list how will it improve the time complexity?

arpanbanejee