Dijkstra's Algorithm: Explanation, Examples & Code

Поділитися
Вставка
  • Опубліковано 13 гру 2024

КОМЕНТАРІ • 89

  • @dans_pool
    @dans_pool 6 років тому +92

    Wow, This is really good.
    1. Good English
    2. Entertaining
    3. Super clear

  • @omriram6960
    @omriram6960 6 років тому +53

    Good job at making a boring topic very entertaining and enjoyable to learn!

  • @nileriver2313
    @nileriver2313 7 років тому +15

    Thanks for going through the code line by line, I wish more people would do that. (Great video, Thanks)

  • @nsllvballer12
    @nsllvballer12 4 роки тому +2

    Your illustrations are excellent, your level of enthusiasm is unmatched, and simply put, your explanations of the subject at hand are simple and concise. Thank you so much for this video, it has really helped me!

  • @dnavas7719
    @dnavas7719 4 роки тому +12

    23:39 Is it just me or you're missing the line where you add the neighbors to the priority queue?

  • @tonyli1957
    @tonyli1957 2 роки тому

    best Dijkstra video I have found so far

  • @KhanSlayer
    @KhanSlayer 6 років тому +4

    Make more of these. That was great. Lots of conceptual walk through in the beginning, white boarding, and then code at the end. Perfect man.

  • @ok_ok0
    @ok_ok0 2 роки тому

    Man I love you, if I pass my finals it will be thank to you

  • @moatazemad7070
    @moatazemad7070 4 роки тому +2

    Wow first video i watched on UA-cam for your channel i programming for such 6 months and i want say that your the best one in the whole field keep going my man plz❤❤

  • @szn0007
    @szn0007 3 роки тому

    Best Video on Dijkstra's Algorithm

  • @chahalpawanpreet
    @chahalpawanpreet 3 роки тому

    this is so good! this guys brain is clean

  • @nniazoff
    @nniazoff 7 років тому +1

    Wow don't usually comment much but this is awesome. We need more of this kinda stuff on UA-cam! Thanks!

  • @Twysthor
    @Twysthor 6 років тому +13

    I’ve noticed you’re not updateing your Set of “visited” nodes in the pseudocode. Besides that, you explain things very well. I’m subbing

    • @fifa23enjoyer
      @fifa23enjoyer 5 років тому +1

      Nice catch!

    • @fifa23enjoyer
      @fifa23enjoyer 5 років тому +1

      Nice catch!

    • @viniciusls1
      @viniciusls1 5 років тому

      should that be added inside and at the end of if(!visited) condition?

    • @zhenghr
      @zhenghr 5 років тому +1

      No. Should add after line 19, to add newSmallest to visited.

    • @miteshkumar3183
      @miteshkumar3183 4 роки тому

      @@zhenghr Yeah it should be added before the inner for loop. You can allow multiple instances of the same node be in the priority queue at the same time, but you only want to
      use the one with the minimum priority in your algorithm. Ideally you would use a priority queue that has a decreaseKey method impelmentation that will allow you to update
      the priority and move it up in the heap, but java doesn't have that, so you can just have multiple instances.

  • @ultimatemathew
    @ultimatemathew 3 роки тому

    Is this at mission park in fremont?

  • @code2287
    @code2287 Рік тому

    Overpowered had me Rolling....Damn this dijakstra guy OP!!!

  • @NathanSass
    @NathanSass 3 роки тому

    Great content, love the energy. Kept me very entertained.

  • @JD_Mortal
    @JD_Mortal 5 років тому +1

    You are also forgetting that it will show you the "Path" from your start point, to any other point, which is shortest, if you sort the results in numeric order. Using the "last visited" list as your "ordering". (You take the last-visited with the smallest number, working backwards from your destination.) Thus, you know all shortest distances and paths, at the same time.
    You jumped right into the "tree" comparison, which is a great representation of the shortest-path, as a map, but it doesn't tell you how to get from point A to Z, it just represents all points with the shortest paths. (Had you used other numbers, you could have ended-up with a full map, exactly like you had from the start. It just happened that, in this instance, you excluded two isolated paths which were horribly long, in all path instances.
    There is also, rare instances, where you need to extend comparison, beyond "checked", when paths have equal values, as both paths can/may be pertinent. This specific formula will ultimately be bias, as it will always pick the "first shortest", as the second equally short path will be discarded, and that may have been a shorter path for another node-set, but it was discarded in favor of the first node set, which may have a longer path to another node.
    But, I understand, it's not "your algo"... and this is only a simple demonstration of, "how it works in a perfect world."

  • @fantasy9960
    @fantasy9960 Рік тому

    Thanks , this is really good! I learned a lot

  • @hakanabi6659
    @hakanabi6659 4 роки тому

    Hi. can u program the connectivity of a small dijkstra maybe with 5 nodes pls.

  • @chandrimakumar8533
    @chandrimakumar8533 4 роки тому

    Which ide do you use

  • @romedsoft5182
    @romedsoft5182 5 років тому +1

    I can not see in what part of the code you mark as visited a node :o

  • @woofsakura1013
    @woofsakura1013 2 роки тому

    best explanation and good english

  • @miguelballen4119
    @miguelballen4119 5 років тому +1

    Pretty good explanation

  • @itsmejohnson0891
    @itsmejohnson0891 3 роки тому

    Need the code for codeblocks. Do you have?

  • @viniciusls1
    @viniciusls1 5 років тому +1

    Great video! just a suggestion... if you track the edges instead of vertices will make you replace totalcost and previous by only one variable (map)

  • @professorfinesser4322
    @professorfinesser4322 5 років тому +1

    when do you add a node to visited

    • @viniciusls1
      @viniciusls1 5 років тому

      Same question here... Have you found it? I supposed it should be inside and at the end of if(!visited) condition

  • @Maria-nu5yo
    @Maria-nu5yo 6 років тому

    This rocks. Keep making these videos dude!!!!!!

  • @replicatoria
    @replicatoria 3 роки тому

    Question: Should not the edges have directions?

  • @danielbergholz9699
    @danielbergholz9699 5 років тому

    This was VERY chill

  • @anette0911
    @anette0911 2 роки тому

    Thanks for this amazing content! ❤

  • @AHermas
    @AHermas 7 років тому +3

    this was amazing pal , thanks a lot

  • @Akashascosset
    @Akashascosset 5 років тому

    Love your enthusiasm!

  • @quangzoroark100
    @quangzoroark100 4 роки тому +1

    Hey bro, do you gonna continue this or not, because you are soooo good at making entertaining but useful video like this. I'm looking forward for your new vids.

  • @yekaalohabtemichael5068
    @yekaalohabtemichael5068 6 років тому

    Really great. Hope to learn more. I like the way you explain

  • @vidyabhushan7655
    @vidyabhushan7655 4 роки тому

    good style , loved the video!

  • @schweizergeizer8028
    @schweizergeizer8028 7 років тому

    really nice code explanation, keep going like that

  • @raha5184
    @raha5184 4 роки тому

    This was awesome, thanks!

  • @Boom655
    @Boom655 4 роки тому

    Very good!

  • @carltonwilcox2221
    @carltonwilcox2221 5 років тому

    Awesome job dude!!!

  • @ArizecCreations
    @ArizecCreations 6 років тому

    Thanks for this. It was a super helpful video!

  • @MrEmpirz
    @MrEmpirz 4 роки тому

    your super hero thanks for explanation

  • @sheriffcrandy
    @sheriffcrandy 4 роки тому

    Thanks bro!

  • @elesegerardo
    @elesegerardo 6 років тому

    Great content!

  • @savio9918
    @savio9918 6 років тому

    Many thanks for this video sir

  • @pakliksiu9539
    @pakliksiu9539 7 років тому

    This video is awesome indeed !

  • @boobareko8803
    @boobareko8803 6 років тому

    i need the code please

  • @myduffly
    @myduffly 6 років тому

    cool stuff bro !! keep it up !!

  • @scum3112
    @scum3112 3 роки тому

    I wish I was as enthusiastic and passionate about Computer Science as you. I love computers and technology and when I understand the code it is fun... but I am simply not that smart and Data Structures is a struggle for me.

    • @chill_cs4627
      @chill_cs4627  3 роки тому +1

      Bro (or gal), it's all about grind. Don't worry about what you think about how smart you are, that doesn't matter. Just grind until you achieve mastery, ez. I just treated this like a MMO since I used to play MapleStory a lot and I applied the same concepts of leveling up to mastering these computer science concepts. Theoretically anyone can get to a really high level in a MMO, and I'm pretty sure that for most people the same concept applies in learning computer science, just gotta grind grind grind
      If it helps, it look me a long ass time to learn many concepts in computer science. the main advice is just to commit yourself to learn a bit daily -- it actually pays off in the long run, I learned from personal experience and I wish I knew that earlier. You feel like you're a genius when you finally get it but it's actually shadow clones of urself that committed to learning daily that got you that mastery, it was your hard work that got you there

    • @scum3112
      @scum3112 3 роки тому

      @@chill_cs4627 wow, this actually really helps. I play a shit ton of video games and grind hard in all of em. I guess I have to put in that same work for CS. Thanks man.

    • @chill_cs4627
      @chill_cs4627  3 роки тому +1

      ​@@scum3112 For full transparency, I learned this specific algorithm and also many other algorithms/data structures in school. School resources like lectures and collaboration with other students/teachers definitely makes the process faster since people are often working on similar problems. Besides engaging with these resources, I would say that a large amount of time is still spent doing individual work, just trying to solve problem sets, peeking at the answer key to see if you're right (if an answer key exists), and experimenting with new approaches if your answer is wrong. I think that school can accelerate the rate at which you can learn CS, I can't deny this.
      However, I also think, from experience learning coding/algorithm/data structure-related topics online that I didn't specifically learn in school, if you have discipline/flexible thinking and are able to put in hard work by yourself, you can also make tremendous progress just using resources available online. I will say that my experiences in school helped me pick up new related topics, but I still had to put in the time and effort to understand the new topics/concepts and experiment with them personally. Whatever way you take will require you to consistently put in a large amount of hard work. But just need to take it step-by-step. Just wanted to give a more detailed perspective, hopefully it helps.

  • @MrKiraBR
    @MrKiraBR 5 років тому

    Why did you abandon UA-cam?

  • @rohanvishayal8724
    @rohanvishayal8724 4 роки тому

    Thank you.

  • @miguelprincipegoods1906
    @miguelprincipegoods1906 6 років тому

    I need this code in VBA excel, please!!

    • @JoseAlvarez-dl3hm
      @JoseAlvarez-dl3hm 5 років тому

      Better to learn Python and work excel spread sheets using its module named pandas. It will give you more power and flexibility than VBA

  • @JinbuTrades
    @JinbuTrades 2 роки тому

    good shit bro

  • @zeusjackson1855
    @zeusjackson1855 6 років тому +2

    wow this is good

  • @jaycepayne7384
    @jaycepayne7384 6 років тому

    Good video

  • @fifa23enjoyer
    @fifa23enjoyer 5 років тому

    Cool guy, Cool video!

  • @kadirguney5051
    @kadirguney5051 3 роки тому

    ı Am so happy for your happy

  • @yunzensal5466
    @yunzensal5466 5 років тому

    God i wish i had profesor that are as good explainers as you, all i get is boring stereotyped nerds

  • @captaint98
    @captaint98 7 років тому

    thanks :)

  • @-Pravalikareddy-vc8ij
    @-Pravalikareddy-vc8ij 4 роки тому

    Where is the code 😠😠😡😡

  • @Kmaxi
    @Kmaxi 2 роки тому +1

    Why is this guy hanging out at a playground 👀

  • @toddtrulock6809
    @toddtrulock6809 2 роки тому

    did anyone else rewind to see if he threw the bird?

  • @RealityWizard
    @RealityWizard 5 років тому

    Dijkstra was definitely op. HAHAA

  • @DarrienGlasser
    @DarrienGlasser 5 років тому

    Absolute DINGBAT, but I love it 😆

  • @cindyshells6993
    @cindyshells6993 4 роки тому

    Men I love you!

  • @rollerdaddy
    @rollerdaddy 4 роки тому

    you are so epic #epic

  • @ianlins2792
    @ianlins2792 6 років тому

    Did anyone notice how long his neck is?

  • @davidhanover8224
    @davidhanover8224 6 років тому +1

    this is a comment

  • @chelseaip759
    @chelseaip759 5 років тому

    you're so funny HAHAH

  • @MustafaOzanAlpay
    @MustafaOzanAlpay 6 років тому +2

    "boy dijkstra"? jeez

  • @littledarkone9261
    @littledarkone9261 5 років тому

    This code is totally useless and just doesnt work

    • @yoeby
      @yoeby 5 років тому

      I figured. Tried converting it into Java and its not working properly

    • @miguelballen4119
      @miguelballen4119 5 років тому

      @@yoeby It's pseudo code as presenter said

  • @kevinspacey6090
    @kevinspacey6090 5 років тому

    Eat a dog next.

  • @alvinlepik5265
    @alvinlepik5265 6 років тому

    tone down the ebonics, more content, less meaningless filler

  • @fifa23enjoyer
    @fifa23enjoyer 5 років тому

    Cool guy, Cool video!