Kruskal's algorithm in 2 minutes

Sdílet
Vložit
  • čas přidán 24. 11. 2012
  • Step by step instructions showing how to run Kruskal's algorithm on a graph.
    Code: github.com/msambol/dsa/blob/m... (different than video, I added this retroactively)
    Source: Algorithms by S. Dasgupta, C. H. Papadimitriou, and U. V. Vazirani [www.amazon.com/Algorithms-San...]
    LinkedIn: / michael-sambol

Komentáře • 416

  • @AnishKaranPhotography
    @AnishKaranPhotography Před 8 lety +1544

    Are you from outer space? My lecturer couldn't explain this in 2 hours and you did in 2 mins. Thanks a lot.

    • @peterbakke
      @peterbakke Před 6 lety +57

      Math and CS educators need to work backward from this video. Have the students obtain an intuitive understanding of what's going on, and then drone on for 2 hours. Hopefully, something sticks. Way to go, Michael!

    • @diwang4572
      @diwang4572 Před 3 lety +12

      @@Fedorahatter exactly, my professor talked about bunch of lemma and proofs first and then go on briefly touched upon the algorithm which we were all lost by the time he talked about it which was like 1 hour into the lecture.

    • @mavyfaby
      @mavyfaby Před 2 lety +2

      Same, this video is much better than my lecturer explaining this topic in an hour still I didn't understand. I wish he'll explain like this.

    • @adelalmohtaseb5261
      @adelalmohtaseb5261 Před rokem

      Fr me as well.

    • @danielriley3618
      @danielriley3618 Před 10 měsíci

      😆

  • @Elmirgtr
    @Elmirgtr Před 9 lety +629

    you explained something in 2 minutes what my prof did in two lessons.

    • @MichaelSambol
      @MichaelSambol  Před 9 lety +24

      Elmir Ma Glad I could help!

    • @Griff10poldi
      @Griff10poldi Před 8 lety +6

      +Elmir Ma Same thing here.. I've wasted my time at class lol

    • @Elmirgtr
      @Elmirgtr Před 8 lety +4

      Griffin Seannery and I ended up doing well in that class. Thanks again, uploader!

    • @school_pizza
      @school_pizza Před 4 lety +1

      @@Elmirgtr Some stories have fairy tale endings.

    • @Elmirgtr
      @Elmirgtr Před 4 lety +4

      @@school_pizza So true. When I wrote this I was in undergrad, now I am doing PhD and working on a paper to submit to Nature

  • @mohammedabdulrafay
    @mohammedabdulrafay Před 5 lety +82

    “If you can't explain it to a six year old, you don't understand it yourself.”

  • @R1CARD049
    @R1CARD049 Před 8 lety +195

    Thank you so much, we were given incomprehensible pseudo-code and confusing notation. For this to seem so simple after a

    • @MichaelSambol
      @MichaelSambol  Před 8 lety +12

      +Richard Paul You're welcome, Richard. Glad you enjoyed.

    • @08a14979
      @08a14979 Před 6 lety +13

      i hate discrete math with passion. making something simple look so complicated

    • @biblemansings
      @biblemansings Před rokem

      @@08a14979 lmao im genuinely worried im going to fail discrete math. I swear it’s how my professor teaches. He overcomplicates everything and he will talk about one thing for like an hour so it’s too easy to get confused.

  • @xbit97
    @xbit97 Před 3 lety +44

    It's incredible how my teacher's lessons started talking about cycles and cuts and shit formulas while the algorithm is so freaking simple... Order edges by weight, go through them in that order, if the edge connects different trees use it, if it connects the same tree discard it, was that so difficult? Thank you for this clear explanation dude, you rock

  • @saeedbaig4249
    @saeedbaig4249 Před 6 lety +17

    0:56 - "Notice the smallest edge is BE, but this node connects 2 nodes that are already in the same tree, so it will not be chosen."
    I think you could have picked your words better. The reason we don't choose BE is NOT because B and E are already in the same tree (I mean, so were A and C, yet you added AC), but because adding BE would create a cycle in the tree, and MSTs aren't supposed to have cycles.

    • @kirandhakal8601
      @kirandhakal8601 Před 2 měsíci +5

      You cleared my confusion. Thank you.

    • @keagenmccartha7412
      @keagenmccartha7412 Před měsícem +1

      how is that confusing? if both points are already discovered then u arent adding a new point to the tree... its just a wasted edge

    • @squeesquee6
      @squeesquee6 Před měsícem

      @@keagenmccartha7412because he did that with AC even though both were already in the tree. Just because you are r€t@rded doesnt mean you need to yap about it to everyone else.

    • @anirudhkrishna.s5397
      @anirudhkrishna.s5397 Před 24 dny +1

      @@keagenmccartha7412 because "A spanning tree of a graph consists of all nodes of the graph and some of the
      edges of the graph so that there is a path between any two nodes"

    • @keagenmccartha7412
      @keagenmccartha7412 Před 24 dny

      @@anirudhkrishna.s5397 congrats genius

  • @MisterTipp
    @MisterTipp Před 8 lety +108

    Fucking legend mate!

  • @wade3ed
    @wade3ed Před 3 lety +27

    tfw: this is actually really simple but your professor unnecessarily complicated it

  • @Unknownsoldier740
    @Unknownsoldier740 Před 7 lety

    Fast, clean, and with a good example. Quality work, you did good. Thank you.

  • @samanthajane4900
    @samanthajane4900 Před 7 lety

    Thanks - this was concise and helpful. It cleared up my confusion of whether the tree must be connected from the beginning or not.

  • @w4439
    @w4439 Před 6 lety +12

    Your tutorials are the best! I learned 2 months of discrete mathematics in under 30 minutes. 5 years have passed since you posted this but it has had a larger impact on my understanding than my professor has provided all semester. Thanks.

  • @asdf9481234
    @asdf9481234 Před 5 lety

    you're making those kind of how to-videos everyone is looking for, a good explanation with no annoying blabla, thank you!

  • @har0111890011
    @har0111890011 Před 2 lety +4

    Absolute Chad ; Saving me from my algorithms exam tomorrow.
    My Lecturer took so much explaining these concepts but you are a genius made it easy in no time.
    Cheers !

  • @darthrevan204
    @darthrevan204 Před 7 lety +1

    4 hours of discrete mathematics lectures and seminaries ... compressed in 2 minutes. you sir, are a life saver

  • @geekinthehattech
    @geekinthehattech Před 10 lety +9

    Very nice video. Straight to the point and quick.

  • @KillerKillcam
    @KillerKillcam Před 9 lety +4

    because of your videos, I learned Kruskal's and Prim's algorithms in 4 minutes. My teacher took 10 minutes to do an example of Prim's and I didn't even understand it then. thanks!

  • @me-zb7qm
    @me-zb7qm Před 7 lety

    Thank you so much for this, my professor didn't even explain a thing but included this in the midterm I'm having in 13 hours. You're a lifesaver.

  • @gongjiaji2489
    @gongjiaji2489 Před 6 lety

    you are my time saver, I spend many hours on PPT, blog and other videos, none of them explain so clearly in this manner. they try to be professional so that they don't speak nature language. Thank you very much.

  • @user-hl2pr4qg8e
    @user-hl2pr4qg8e Před 20 dny

    The explanation is very intuitive and concise, thank you so much.

  • @indieelectroworks
    @indieelectroworks Před 7 lety

    Your material is simply excellent! I can't wait for more!

  • @mitchell2719
    @mitchell2719 Před 8 lety +7

    This was way easier than my prof's explanation. Thank you so much!

  • @RigorousExplorer
    @RigorousExplorer Před 19 dny

    Dude I spent a whole lecture not understanding and it's actually this straight forward

  • @anything413
    @anything413 Před 9 lety

    Great stuff man,,, crisp and precise... never going to forget Kruskal's algo now

  • @SaminaAKhan-ck1oj
    @SaminaAKhan-ck1oj Před 8 lety

    You are awesome. Seriously you taught a whole book chapter in just two minutes. 👍🏻

  • @salihbalkan5083
    @salihbalkan5083 Před 8 lety +2

    Perfect tutorial I have ever seen. Thanks, I got it in just 2 minutes!

  • @AvengersTrex
    @AvengersTrex Před 7 lety

    Short, simple and clear. Good work !!
    Many thanks to you

  • @Elliott_Ives
    @Elliott_Ives Před 4 lety

    Michael, your vids are so succinct and effective.

  • @ausreir
    @ausreir Před 4 lety

    Concise and easy to understand, many thanks, Michael.

  • @Sonikkid1
    @Sonikkid1 Před 3 lety

    Even in 2021, you are still relevant. Thank you for your service

  • @emilyhuynh7855
    @emilyhuynh7855 Před 8 lety +3

    You're a lifesaver! Got an exam tomorrow and my textbook nor my professor was making sense to me. Glad to know it was a much easier process than I initially thought!

    • @Dorddis
      @Dorddis Před rokem +2

      he's saving lives still... been 6 years!

  • @alexeukleidis1611
    @alexeukleidis1611 Před 8 lety

    Sir you are the Best!!!!!!!
    The shortest and meaningful video that can be created!!!!
    Thank you SO much!!!!

  • @mrbloke491
    @mrbloke491 Před 7 lety

    my god man you are amazing, you just explain it without taking 10 years THANK YOU

  • @OdiyaS
    @OdiyaS Před 8 lety

    Thanks!!! You literally saved me ... and my exam's tomorrow! You explained something in 2 minutes when in class it took like 2 hours!

  • @jimboi95
    @jimboi95 Před 10 lety

    Simple and straight to the point. Thankyou so much!

  • @BendenDrijver
    @BendenDrijver Před 9 lety

    This saved me so much time. Very clear and informative video, thank you!

  • @AaronccGuo
    @AaronccGuo Před 8 lety

    i liked the way you guys explain it, shor and clear.

  • @AwsomeAlligator
    @AwsomeAlligator Před 7 lety +3

    It would be cool if you added a short video about union and find as an addition to this video, as the intuition for Kruskal's algorithm is explained brilliantly here, but the implementation needs to use union and find for the complexity to be as good as you mention and these functions are quite interesting and not completely trivial.
    Thanks for all your great videos btw, they are very clear and concise :)

  • @thomaschurch1969
    @thomaschurch1969 Před 2 měsíci

    Very succinct and to the point. Thanks for this.

  • @madeleine6472
    @madeleine6472 Před 9 lety

    Really saved my day after spending hours in the text books to understand this. Thanks a lot!

  • @yadvainderasood9728
    @yadvainderasood9728 Před 10 lety

    Short and comprehensive... Great job!!!

  • @curticelockhart87
    @curticelockhart87 Před 5 lety

    This was beautifully done, thank you!

  • @JamesBrodski
    @JamesBrodski Před rokem +1

    Great video. Thanks so much for making it!

  • @joeyyshumm
    @joeyyshumm Před 4 lety

    Thank you so much. This is the clearest explanation I've seen

  • @MNKW123
    @MNKW123 Před 8 lety

    Thank you!! Excellent explanation contrary to the million slides in my notes that are just plain confusing.

  • @Xtremedave2
    @Xtremedave2 Před 8 lety

    Ohhh I never knew that the arcs should only add new nodes, I was only taught that it should not create cycles. This makes it a lot easier. Great vid mate

  • @SOCAL_SHORTS_FACTORY
    @SOCAL_SHORTS_FACTORY Před 7 lety

    Saved me so much time. Thank you for great videos.

  • @66saly
    @66saly Před 7 lety

    Short and clear review, thanks 👍

  • @gunjansethi2896
    @gunjansethi2896 Před 8 lety +2

    Saved my life on the exam morning!
    Thank you so much :D

  • @marflage
    @marflage Před 4 lety +27

    For those who are a bit confused, he did not search for 7 by skipping 4, 5, 6. He did in fact search for them but found them to be making a circuit (closed path with previously chosen nodes).

  • @beani5355
    @beani5355 Před 2 lety

    Straight forward👏🏼nice one

  • @rewinder802
    @rewinder802 Před 8 lety

    short and sweet i like it. Keep up the good work!

  • @capelo2148
    @capelo2148 Před 7 měsíci

    You are a LIFE SAVIOR. Thanks!

  • @matejpersic6601
    @matejpersic6601 Před 5 lety

    Thanks man! Just as your video on ford-fulkersons algorithm, simple and straight forward. Cheers

  • @avtaras
    @avtaras Před rokem

    This is amazing, love this channel! Thank you :)

  • @fcmello1
    @fcmello1 Před 6 lety

    Thanks for helping, got a test today and explained much better than my professor. Thanks a lot :D

  • @felixcuello
    @felixcuello Před 4 lety +9

    I wondder WHY at university they spend 20-30 minutes explaining this, and having round of questions. Your 2 minute videos explaining algorithms are simply PERFECT. Thank you very much indeed.

  • @prajaktadeosthali3083
    @prajaktadeosthali3083 Před 8 lety

    Thanks a lot for this short explanation!

  • @emadharazi5044
    @emadharazi5044 Před 4 lety

    I did not think it was possible. Nicely done

  • @nibrobb
    @nibrobb Před 3 lety

    Excellent explanation!

  • @ejsafara456
    @ejsafara456 Před rokem

    amazing, just what i wanted and needed

  • @Lala96926
    @Lala96926 Před 10 lety

    Thank you!! You are an amazing person! You made it so simple! x

  • @Zeppelin-ep7uv
    @Zeppelin-ep7uv Před 3 lety

    excellent work, man!

  • @volo7
    @volo7 Před 7 lety

    what a fantastic video. seriously this is a great explanation shrunk to a 2 min video

  • @JoonJulyAugust
    @JoonJulyAugust Před 7 měsíci

    Ran across this video again during my university algorithm course studies. Thank again Mike!

  • @user-zk3bc6cc2g
    @user-zk3bc6cc2g Před 6 lety

    always awesome algo

  • @eunicefoo4499
    @eunicefoo4499 Před 2 lety

    You're amazing. Thank you !

  • @pchanio
    @pchanio Před 3 lety +1

    I just love that you simply get to the point.

  • @dlim9696
    @dlim9696 Před 6 lety

    Hi I have a final exam CS 1332 tomorrow morning and your video helped me a lot. Thanks so much and go Yellow Jackets!

  • @WuddupDok
    @WuddupDok Před 8 lety

    Great explanation, thanks for this.

  • @winterfoxx6363
    @winterfoxx6363 Před 2 lety

    This channel is the best. I wish I watched these in college. Please make more videos on algorithms topics!

  • @putin_navsegda6487
    @putin_navsegda6487 Před rokem

    sir thank you ! it's very clean and understandable explication !

  • @czoknorris
    @czoknorris Před 8 lety

    Very nice! Thanks from Munich.

  • @mathieubrousseau92
    @mathieubrousseau92 Před 7 lety

    I love you vids, really helpful, keep it up.

  • @rrrushan
    @rrrushan Před 2 lety +1

    Still relevant in 2021. Thank you!

  • @Bullyfan6797
    @Bullyfan6797 Před 5 lety

    You're awesome dude, great vids

  • @howardhuang3959
    @howardhuang3959 Před 3 lety

    wow, that is a really nice explanation, thanks for sharing!!!!

  • @Punisher35709
    @Punisher35709 Před 9 lety

    Awesome explanation ever!

  • @whatthego
    @whatthego Před 8 lety

    Simple and no bullshit. Love it!

  • @dnfrd2
    @dnfrd2 Před 6 lety

    summer test tomorrow for my discrete math class, ur a hero

  • @Ambious
    @Ambious Před 8 lety

    Very intuitive, thank you!

  • @sahilghuge5302
    @sahilghuge5302 Před 2 měsíci

    Generational help done by u 😭🛐

  • @WVZEIJL
    @WVZEIJL Před 7 lety +1

    Thanks fam, your review and example vids are dank af

    • @ryandavis7506
      @ryandavis7506 Před 7 lety +1

      haha didn't think I'd see the word 'dank' uttered in the comment section of an algorithms review video...classic

    • @WVZEIJL
      @WVZEIJL Před 7 lety

      Ryan Davis ayy got a 7.7 / 10 partly thanks to this guy

  • @user-hj2go1ur8i
    @user-hj2go1ur8i Před 7 dny

    thank you bro, you are the real man

  • @mariestolk3794
    @mariestolk3794 Před 4 lety

    Great video, thanks!

  • @Khadari2013
    @Khadari2013 Před 4 lety +10

    what amazes me is how I seat through 2 hour of lecture class and couldn't understand a jack thing but 2 minute video and I feel like replacing my professor so I can teach the class.

    • @mariestolk3794
      @mariestolk3794 Před 4 lety

      Same

    • @rrestoring_faith
      @rrestoring_faith Před 4 lety +3

      I would still suggest staying in lectures.
      For instance, this videos states that you can use merge sort to sort the Edges. Which is fine and true, but why would you even bother? Why use merge?
      Why not a priority queue?
      He also doesn't explain the time complexity. You can perform Kruskal's in O(ElogV) but his is O(ElogE) because merge sort is dominating. Which is better? [Most examples show E >= V].
      These videos are great for getting the point and quickly understanding how it works, but when you get into it the details may not be as good as you'd think.

    • @theendurance
      @theendurance Před 3 lety

      @Rrestoring faith Exactly. This video doesnt actually teach you anything. It simply shows what Kruskal's aglorithm is. This is way too basic to be useful

  • @aluskalopes9556
    @aluskalopes9556 Před 6 lety

    thank you so much, you helped me a lot because I will have a test about this algorithm.

  • @li-pingho1441
    @li-pingho1441 Před 3 lety

    The best tutorial ever

  • @gilbertvirgo5672
    @gilbertvirgo5672 Před 7 lety

    This is great, best Math video on CZcams.

  • @corvo8754
    @corvo8754 Před 2 lety

    perfect explanation

  • @JoonJulyAugust
    @JoonJulyAugust Před 2 lety

    Thanks Mike!

  • @JTMcAwesomeFace
    @JTMcAwesomeFace Před 11 lety

    Quick and simple, thanks!

  • @webapplicationguide3798

    Thanks for making it simple !!

  • @edwardlie3845
    @edwardlie3845 Před 4 lety

    u help me alot man .. good jobb broo

  • @amansrivas1572
    @amansrivas1572 Před 7 lety

    thanks dude!! Good work!! :D

  • @gomes8335
    @gomes8335 Před 6 lety

    Precise and perfect

  • @cwhazzoomain
    @cwhazzoomain Před 9 lety

    Thank you for the video!

  • @m-noble-4-731
    @m-noble-4-731 Před 7 lety

    Saved my life. Subbed

  • @mohsenalbo5533
    @mohsenalbo5533 Před 3 lety

    dude your saving lives here

  • @user-zk3bc6cc2g
    @user-zk3bc6cc2g Před 7 lety

    precise and concise

  • @30filip50
    @30filip50 Před 2 lety +1

    Thank you so much.