Dijkstra algorithm | Code implementation

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ธ.ค. 2024

ความคิดเห็น • 92

  • @rachellee9906
    @rachellee9906 4 ปีที่แล้ว +12

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

  • @princebhati6376
    @princebhati6376 4 ปีที่แล้ว +7

    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.

  • @PiyushKumarPorwal
    @PiyushKumarPorwal 4 ปีที่แล้ว +68

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

  • @manikantabandla3923
    @manikantabandla3923 4 ปีที่แล้ว +10

    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.

  • @mayank_singh_43
    @mayank_singh_43 2 ปีที่แล้ว

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

  • @rishabhgoyal8110
    @rishabhgoyal8110 4 ปีที่แล้ว +7

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

  • @kumarpriyansh4238
    @kumarpriyansh4238 4 ปีที่แล้ว +4

    Exactly what i was looking for. Thank you sir.

  • @mayurkapadnis4265
    @mayurkapadnis4265 2 ปีที่แล้ว +3

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

  • @anushrut5
    @anushrut5 4 ปีที่แล้ว +2

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

    • @techdose4u
      @techdose4u  4 ปีที่แล้ว

      😂❤️

    • @crimsoncad3230
      @crimsoncad3230 4 ปีที่แล้ว

      @@techdose4u That's you Ninja way.

  • @chenghuilee6982
    @chenghuilee6982 4 ปีที่แล้ว +2

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

  • @ajitbombe5168
    @ajitbombe5168 3 ปีที่แล้ว +2

    Thanks...
    Simple and clear explanation.

  • @UK-04.0
    @UK-04.0 7 หลายเดือนก่อน

    Helpful 🙂

  • @bhaveshvarma4313
    @bhaveshvarma4313 3 ปีที่แล้ว +3

    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.

    • @techdose4u
      @techdose4u  3 ปีที่แล้ว

      Hmmm...I will show it in some problem

  • @chinmoybhattacharya9561
    @chinmoybhattacharya9561 2 ปีที่แล้ว +2

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

  • @MDIbrahim-oq3vk
    @MDIbrahim-oq3vk 2 หลายเดือนก่อน

    very good explanation sir

    • @techdose4u
      @techdose4u  2 หลายเดือนก่อน

      thanks

  • @rishabhkumar8115
    @rishabhkumar8115 3 ปีที่แล้ว +2

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

  • @DhruvilPatel
    @DhruvilPatel 3 ปีที่แล้ว +2

    Simple and clear!

  • @kunalsoni7681
    @kunalsoni7681 4 ปีที่แล้ว +1

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

    • @techdose4u
      @techdose4u  4 ปีที่แล้ว +1

      Welcome bro :)

  • @PriyankaSharma02499
    @PriyankaSharma02499 3 ปีที่แล้ว +1

    Very nice explanation 🙂

  • @mananmehta2320
    @mananmehta2320 2 ปีที่แล้ว

    13:20 Is this process necessary? To go and check which nodes haven't been visited...?

  • @aishikroychaudhury8656
    @aishikroychaudhury8656 4 ปีที่แล้ว +5

    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?

    • @techdose4u
      @techdose4u  4 ปีที่แล้ว +1

      Yes it does. You can choose any one.

  • @ayyappareddy4461
    @ayyappareddy4461 4 ปีที่แล้ว +1

    Thank you sirrrrr superrr explaination

  • @theghostwhowalk
    @theghostwhowalk 4 ปีที่แล้ว +1

    As always! Spot on great explanation.

    • @techdose4u
      @techdose4u  4 ปีที่แล้ว +2

      Thanks :)

    • @theghostwhowalk
      @theghostwhowalk 4 ปีที่แล้ว

      @@techdose4u One Q.. Are you planning to cover Bellman-Ford too? for -ve weight cycles..

    • @harshgupta9761
      @harshgupta9761 3 ปีที่แล้ว

      @@techdose4u can you explain dijkstra by adjacency list and min heap

  • @v.sreesairam9488
    @v.sreesairam9488 3 ปีที่แล้ว +1

    understood :) thank you bhaiya

  • @ApoorvaRajBhadani
    @ApoorvaRajBhadani 3 ปีที่แล้ว +2

    Please also include code for Priority Queue implementation. Why create half videos.
    Anyways the explanation is excellent.

    • @techdose4u
      @techdose4u  3 ปีที่แล้ว +1

      It's easy to replace the priority queue code :)

  • @arpanbanejee5143
    @arpanbanejee5143 3 ปีที่แล้ว +2

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

    • @techdose4u
      @techdose4u  3 ปีที่แล้ว +1

      If the graph is sparse use list otherwise array.

  • @nikoangiuli
    @nikoangiuli 3 ปีที่แล้ว +1

    Thanks is a precious explanation. Can I ask you if Dijkstra's algorithm is the one used in the Amazon warehouses to define the pick paths for the pickers?

    • @adithyav9283
      @adithyav9283 3 ปีที่แล้ว

      yes

    • @nikoangiuli
      @nikoangiuli 3 ปีที่แล้ว

      @@adithyav9283 thanks can you suggest me some readings about it?

  • @JSDev776
    @JSDev776 3 ปีที่แล้ว

    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?

  • @akhilsharma1778
    @akhilsharma1778 3 ปีที่แล้ว +2

    I have seen another way of doing it using heap which i think is more time efficient but more complicated, which one should i try because i find the heap one a little difficult to understand?

    • @techdose4u
      @techdose4u  3 ปีที่แล้ว +1

      Heap is also easy. I have explained the simplest approach which everyone can understand but you can use priority queue STL/library to implement heap :)

  • @amitkumargupta6722
    @amitkumargupta6722 4 ปีที่แล้ว +1

    just awesome...

  • @MayankLC93
    @MayankLC93 3 ปีที่แล้ว +1

    THANK YOU !!!!!!!!!!!

  • @AltafHussain-on2oe
    @AltafHussain-on2oe 3 ปีที่แล้ว +1

    Thank you Sir 💖

  • @adarshkaran6611
    @adarshkaran6611 ปีที่แล้ว

    thank you sir!

  • @priyachaturvedi9381
    @priyachaturvedi9381 3 ปีที่แล้ว +1

    Excellent explanation! Could you please make a video on 0-1 BFS as well?

    • @techdose4u
      @techdose4u  3 ปีที่แล้ว +1

      Sure. But it will take time since I want to complete the course 😅

    • @priyachaturvedi9381
      @priyachaturvedi9381 3 ปีที่แล้ว

      @@techdose4u Surely, Sir! Please take your time. 😄

  • @priyanshugupta521
    @priyanshugupta521 3 ปีที่แล้ว

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

  • @ap331
    @ap331 4 ปีที่แล้ว +2

    Sir regarding every algo implementation....it should be practised on daily basis ?

    • @techdose4u
      @techdose4u  4 ปีที่แล้ว

      You should practice atleast 1 problem daily from the topic you feel uncomfortable with.

  • @funWithAnkit
    @funWithAnkit 2 ปีที่แล้ว

    Why to use Dijkstra's algorithm when the BFS using a queue can be used to find minimum distance of nodes from a given source in O(V + E) time complexity.

    • @rupalsharma9948
      @rupalsharma9948 2 ปีที่แล้ว

      Can you share the code for this?

  • @KshitijJain
    @KshitijJain 4 ปีที่แล้ว

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

  • @ayushgarg5929
    @ayushgarg5929 4 ปีที่แล้ว +1

    Sir please make a video on Josephus Problem

    • @techdose4u
      @techdose4u  4 ปีที่แล้ว +1

      Sure bro. I will make it but after finishing current series.

  • @divaynagar1929
    @divaynagar1929 4 ปีที่แล้ว

    will this code give wrong answers for negative weight edges

  • @dayanandraut5660
    @dayanandraut5660 3 ปีที่แล้ว

    can anyone post the link for dijkstra's algo implemented using minheap in java?

  • @ankitjangir01
    @ankitjangir01 2 ปีที่แล้ว

    Isn't is same as Prim's algo ?

  • @itsmejohnson0891
    @itsmejohnson0891 3 ปีที่แล้ว

    Can you execute the code in code blocks and show it?

  • @moulikasunesh2834
    @moulikasunesh2834 4 ปีที่แล้ว +1

    Here the adjacency matrix is created and this doesn't change with the variables. looks like this is hardcoded

    • @moulikasunesh2834
      @moulikasunesh2834 4 ปีที่แล้ว

      And if you have to create this matrix dynamically you should be going through the given data i guess

    • @techdose4u
      @techdose4u  4 ปีที่แล้ว +1

      Adjacency matrix is hardcoded but you can always create taking inputs.

  • @louis1458
    @louis1458 3 ปีที่แล้ว

    7:46

  • @ghoshdipan
    @ghoshdipan 4 ปีที่แล้ว +1

    sir can you please show the java code too

    • @techdose4u
      @techdose4u  4 ปีที่แล้ว +2

      I am providing java codes now. But I did not provide back when I made these videos. I will add them.

  • @kainaatmakhani6550
    @kainaatmakhani6550 2 ปีที่แล้ว

    sir plzz ap yeh dijkstras algorithm ke notes aur coding bhej dijey takhe mein apne paas download kar sakhun plzz?

  • @supernova7870
    @supernova7870 4 ปีที่แล้ว +1

    Sir, why are you always taking minimum distance vertex from VALUE Array , what is the logic behind that ??

    • @techdose4u
      @techdose4u  4 ปีที่แล้ว +1

      Because we want to make a greedy decision to select minimum cost path from all adjacent edges.

  • @pavanioruganti3526
    @pavanioruganti3526 3 ปีที่แล้ว

    How to get distance between neighbours and get neighboursnames

  • @ridimamittal4064
    @ridimamittal4064 3 ปีที่แล้ว

    content is good but voice is tooo low

  • @amc1140
    @amc1140 2 ปีที่แล้ว +1

    Relax?