3.5 Prims and Kruskals Algorithms - Greedy Method

Sdílet
Vložit
  • čas přidán 22. 05. 2024
  • Whats a Spanning Tree ?
    What is a Minimum Cost Spanning Tree?
    Prims Algorithm
    Kruskals Algorithm
    Problems for Spanning Tree
    PATREON : www.patreon.com/bePatron?u=20...
    Courses on Udemy
    ================
    Java Programming
    www.udemy.com/course/java-se-...
    Data Structures using C and C++
    www.udemy.com/course/datastru...
    C++ Programming
    www.udemy.com/course/cpp-deep...

Komentáře • 1,2K

  • @tonyzweb
    @tonyzweb Před 5 lety +3422

    This man is an absolute legend. I can't be bothered to listen to my tutor when I can do a simple youtube search and be done with the current topic in less than 30 minutes. Thank you for your contribution to our CS society, and I'm looking forward to learn from you more things. I'm speaking on behalf of all the CS students here...
    We thank you!

    • @ritik84629
      @ritik84629 Před 4 lety +28

      But if he will give everything on CZcams no one will buy his paid courses on Udemy. He is awesome though!

    • @abhijit-z
      @abhijit-z Před 4 lety +10

      @@abdul_bari No, that's a bad idea. People who don't wanna pay will never pay.

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

      @@abdul_bari Yes sir, please do it. But your channel is so amazing and great knowledge. thoroughly explained concepts. Thank you.

    • @josephmills1104
      @josephmills1104 Před 4 lety +7

      Yup. This man is a treasure.

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

      Sir ne pucha kya tha?

  • @sicals1720
    @sicals1720 Před 3 lety +439

    no ads, no subsrice-like-comment asking. You are a legend sir.

  • @bubkabu
    @bubkabu Před 5 lety +1077

    Abdul, you are one of the best computer science teachers on youtube. Keep it going!

    • @jeyaramt9066
      @jeyaramt9066 Před 3 lety +43

      He is not one of the best computer science teachers on CZcams
      He is the one and only best teacher on youtube❤️

    • @charlesjsescoto
      @charlesjsescoto Před 3 lety +2

      @@jeyaramt9066 where he upload videos now?

    • @mdssohail2314
      @mdssohail2314 Před 3 lety +5

      @@charlesjsescoto At udemy

    • @achintyanaithani889
      @achintyanaithani889 Před 3 lety +32

      Please do call him Abdul sir, considering he's a teacher and is probs reading this.

    • @bubkabu
      @bubkabu Před 3 lety +32

      @@achintyanaithani889 I would argue it's more rude to tell others how to speak, than not to call someone "Sir", while praising them.

  • @mashaido
    @mashaido Před 3 lety +229

    can I acknowledge the smooth relaxing tone that you use to deliver points across in a quick nutshell! It doesn't feel rushed, it's super soothing that I'm sure even those students with assignment deadlines are so chilled out right now as they follow through!

  • @kapildeshpande6220
    @kapildeshpande6220 Před 6 lety +871

    07:46 Prims algorithm
    11:33 Kruskals algorithm

  • @shamanthakrishnakg1978
    @shamanthakrishnakg1978 Před 6 lety +626

    If u already know the meaning of minimum spanning tree skip to 7:35

  • @AdityaFingerstyle
    @AdityaFingerstyle Před 5 lety +568

    In Prim's Algorithm, it is not necessary to choose the minimum cost edge initially. 8:02
    You can choose an arbitrary vertex V and then start building the tree from it.

    • @emadharazi5044
      @emadharazi5044 Před 4 lety +47

      Yes. Great video but its an important point raised here that you can start at any vertex and get the same result.

    • @akashchhetri4827
      @akashchhetri4827 Před 4 lety +51

      Yes but starting off with minimum spanning vertices will cause no harm rather it will help us to recall main motive of prims algo😁

    • @Artaxerxes.
      @Artaxerxes. Před 4 lety +56

      @@akashchhetri4827 Well you obviously don't know the correctness of Prim's algo. You just want to remember it instead of understanding why any arbitrary vertex can be the starting point

    • @jaivardhansingh4185
      @jaivardhansingh4185 Před 3 lety +15

      @@Artaxerxes. The way I am understanding it is that since ultimately after selecting every vertex,what we are doing is that ,we are selecting the edge attached to it which is smallest.
      So,infact we are selecting the smallest edge attached to every vertex. So,there is no need to begin with the smallest edge

    • @suryadeepdas4493
      @suryadeepdas4493 Před 3 lety +2

      Can we start with an edge that will not appear in the final minimum cost spanning tree? like the edge between 1 and 2 in this example?

  • @hassanmonji398
    @hassanmonji398 Před 5 lety +464

    Dear PhD.Abdul Bari,
    Words fail to describe the amount of thanks and respect for your generosity
    you are one of your kind, i have never seen a professional professor like you all the respect to you
    the way you explain and teach the topics is exceptional
    You are in the status of prophets
    Kindest Regards
    your student

  • @Pankajkumar-dy9ef
    @Pankajkumar-dy9ef Před 6 lety +170

    Faith in humanity restored!!!💐

  • @ragibshahariar6852
    @ragibshahariar6852 Před 11 měsíci +19

    You put away my depression and pressure that I was suffering. Thank you for your help. May Allah bless you and your family. I bought you C++ beginner to advanced course from Udemy. I hope I will buy Your Data structure and algorithm course also after finishing C++ course insha-Allah. Thank you sir.

  • @kantimahantyrohit8761
    @kantimahantyrohit8761 Před 3 lety +6

    I watch your videos whenever I am stuck and the best thing is , not only you make us understand the topics but also clear the related and necessary concepts required to understand the topic. Thank you so much sir!!!

  • @tanyasrivastava1592
    @tanyasrivastava1592 Před 5 lety +272

    Sir you're the best teacher... without you I would not have even thought to pass DAA in my sems ♥ Love you loads
    From your loving student 😇

  • @hritvikjamwal4688
    @hritvikjamwal4688 Před 4 lety +7

    The amount of hard-work you put for making this playlist is absolutely commendable. Thanks a lot for such a clear and concise explanation.

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

    Bless you good sir! You managed to explain to me in 20 minutes what my tutor couldn't in an hour.Thanks to your marvelous videos I have a chance to survive the course!

  • @leninnagakumar8376
    @leninnagakumar8376 Před 5 lety +27

    Sir u r soo awesome u helped our whole department gor this semester thanks alot sir
    U have gained a huge fan base by u r ALGORITHMS TUTORIAL
    THANKS ALOT SIR

  • @areebaaslam1343
    @areebaaslam1343 Před 3 lety +34

    You are absolutely the best person who have skills how to convey knowledge...Even in the 9 months of Smester i can't understand what basically data structure is...just because of you I understand complete course of data structure in 3 days and even ready for exam tomorrow....I salute you man😍Allah give you more for this great work👍

  • @attonthegreat
    @attonthegreat Před 3 lety +3

    Thank you Mr. Bari for helping me understand the material before I do my final. Bless you for taking the time into making these videos

  • @kennethkimble3929
    @kennethkimble3929 Před 8 měsíci +1

    thank you for always being patient enough to write a step by step example. And for keeping it simple. Its true that you can learn anything with a good enough teacher.

  • @samjams-world
    @samjams-world Před 2 lety +2

    I have followed all your lectures throughout my masters, and I am really thankful to you, the lectures are very easily understood even for the tougher topics.

  • @ppewd9521
    @ppewd9521 Před 5 lety +13

    thank you so much for taking the time to provide such great explanations :) I always start with your videos before seeing the stuff that my tutor explains. You're just outstanding!

  • @MsFerid567
    @MsFerid567 Před 3 lety +19

    This man is a legend, literally getting carried through this com sci degree

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

    Best thing about your videos->no time waste,straight to the point and very easy to grasp.

  • @lunam.3207
    @lunam.3207 Před 5 lety +4

    I am so grateful for youtube and for you at this moment. You literally have some really great and clear explanations. Thank you thank you thank you!!!

  • @Arcaerus
    @Arcaerus Před 2 lety +3

    Dude you just saved my final and I am so grateful you are an absolute legend that came from heaven. What my prof couldn't do in an hour you did it in 20 minutes, me and my entire algorithms class are grateful for your existence, keep rocking it dude!

  • @yunusshaikh7478
    @yunusshaikh7478 Před 3 lety +10

    I love your explanation and the deep insights I got from your lecture is something very difficult to bind using my words. Thank you so much for arising curiosity inside me for learn data structure this way.

  • @anandiyer5361
    @anandiyer5361 Před 3 lety +2

    The best thing I love about this lecture series is the calmness with which he explains the algos, which are among the most complicated things one could lay his hands on...However, one observation. I'm not sure if the formula Edges C (Vertices-1) - 2 works everywhere. I've graphs where this doesn't work.

  • @Rohit-tz6gs
    @Rohit-tz6gs Před 3 lety +3

    This is a teaching of another level when you can make complex things seem to be simple as well as in less time. ALGO GURU.

  • @swapnil1108
    @swapnil1108 Před 6 lety +5

    You are really awesome! I love the way you teach, along with multiples examples and explanations.
    In some of the lectures, you do not have the coding part, we would like to see them too!

  • @HulloItsBrit
    @HulloItsBrit Před 4 lety +6

    You are amazing ❣️ Cut my studying time down and helped me feel confident. Was really stressed out before.

  • @techabsoluteknowledge4533

    Explain everything in such a simply way..... Thank you sir

  • @thrilleracaste400
    @thrilleracaste400 Před 2 lety +5

    This is one of the best playlist for algorithms. Thank you sir!!

  • @BangMaster96
    @BangMaster96 Před 6 lety +148

    Please make a series on
    Compilers
    Operating Systems
    Computer Architecture
    and other computer science courses if possible
    you are an amazing teacher and explain everything so well

  • @madelinealston3012
    @madelinealston3012 Před rokem +3

    he was born to teach this - I love your videos! very clear and concise

  • @andrenick5086
    @andrenick5086 Před rokem

    You’ve taken something I’ve been struggling with and made it so simple to understand. Thank you so much!

  • @rifatbano210
    @rifatbano210 Před 6 lety +3

    Sir, the way you start explaining the concept and till the end each and everything is simply outstanding. Salute to your teaching method and knowledge as well.

  • @nirmaldalmia7043
    @nirmaldalmia7043 Před 6 lety +4

    Mr. Abdul Bari you are an amazing teacher. You've made the concepts very clear and concise. I am watching your videos just a day before the exam and I think that's enough. Please start teaching other subjects like Operating Systems and Computer Organization also.

  • @MarkMifsud
    @MarkMifsud Před 5 lety +11

    I am at the end of an incredibly busy semester and my class ended up with only a couple of weeks to actually study for Data Structures & Algorithms 2. Your lectures are going to help me pass with flying colours. I like the way you give the simplest example to make your explanation easy & brief. From there I can manage the rest. Thank you very much Sir.

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

    Really you are the best lecturer I have never seen sir ,I understood all your videos thank you somuch sir

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

    Without this teacher, I would have failed in algorithm! Thank you🙏

  • @madhuchintha9418
    @madhuchintha9418 Před 6 lety +51

    You are outstanding sir
    You made very easy learning... thankyou sir...I am very unhappy because I didn't find you till now

    • @hirakmondal6174
      @hirakmondal6174 Před 6 lety +1

      Join Vani Institute

    • @AdvancedSoul
      @AdvancedSoul Před 5 lety +1

      sir.. u make very nice videos tanks very much i learn a lot tonight

  • @Riyad355
    @Riyad355 Před 3 lety +3

    May all the CSE students should follow you for your precious lectures. I fell like somebody shows me some magic tricks. I feel thrilled after watching this.

  • @prashantlakhanpal7375
    @prashantlakhanpal7375 Před 3 lety +2

    Thank You Abdul Ji, I could understand these algorithms in 20 mins so clearly which I could not understand in 2 Hours of classes and 2 days of trying to understand on my own......THanks YOu very much.

  • @mohammedkhalifa544
    @mohammedkhalifa544 Před rokem +1

    Thank you very much your videos made my algorithm class very easy. I hated that subject but now I'm planning on redoing the entire video playlist in summer .

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

    In all Sincerity, this man deserves an award for his deep understanding of computer science logic and his amazing style of teaching, if @youtube should see this comment, please do something, cos I believe a very high number of students, not only computer science students benefit from his lectures.

  • @leooel4650
    @leooel4650 Před 4 lety +7

    This man seems to my eyes that he knows every single thing!
    Sincerely, thank you!

  • @anxthetics
    @anxthetics Před rokem +2

    Clearly understood 👍🏼 never seen such an incredible teacher!

  • @grevierx
    @grevierx Před 3 měsíci

    Best CS teacher out there! Always coming back for more help undergrad and graduate school - thank you so much!

  • @rajasharathchandraacha9542

    this man is absolutely excellent

  • @MrWachakaj
    @MrWachakaj Před 6 lety +3

    Bari, you make my learning very simple and enjoyable. Thanks

  • @mFurb988
    @mFurb988 Před 2 lety

    Clear, concise, calm and detailed explanations with various examples. Amazing video sir.

  • @ibtisam.6309
    @ibtisam.6309 Před 5 lety +1

    You're so good at explaining things man.. Thankyou!

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

    now I like my Subject: ALGORITHM because of this GREAT instructor, Thank You, Sir Abdul Bari

  • @SaurabhSingh-mk1kc
    @SaurabhSingh-mk1kc Před 6 lety +114

    You should make more and more videos.........you are best........please go for java , c++ and C video......as well as web development.........your channel get huge success .......i wish so

    • @gladyouseen8160
      @gladyouseen8160 Před 5 lety

      @@abdul_bari sir do you have any offline coaching at Hyderabad?😊

    • @gladyouseen8160
      @gladyouseen8160 Před 5 lety +5

      @@abdul_bari 🙏 start one please.
      Please prepare videos of computer organisation because many teachers couldn't convey efficiently.

    • @svdfxd
      @svdfxd Před 5 lety

      sir...pls. include java implementations as well. Thanks. v.nice work.

    • @skyman255
      @skyman255 Před 2 lety

      and python

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

    The Best Teacher Of Design and Analysis of Algolrithm I've ever seen.

  • @perezburst
    @perezburst Před 5 lety

    You are truly a great mind, you make these things very easy to grasp.
    Thanks for your service, no matter the motivation for this, its a great job.
    Thank you again sir

  • @Sanjay-yu4kc
    @Sanjay-yu4kc Před 10 měsíci +3

    One stop solution to understand DSA. Thank you sir.

  • @NiveshPatil
    @NiveshPatil Před 2 lety +14

    I love all your lectures, you are one of the best teachers ever sir.
    Thank you soo much for these beautiful lectures.
    I specifically watch all your youtube ads to increase whatever profit you can gain from youtube.

  • @payalsagar1808
    @payalsagar1808 Před 5 lety +1

    the best part is ,you always explain time complexity along with the algorithm....thankyou sr...

  • @user-wu7zo4lq1p
    @user-wu7zo4lq1p Před rokem +1

    The BEST explanation on CZcams. The reason I got an offer for Amazon SDE, thank you!

  • @kabitabhandari2183
    @kabitabhandari2183 Před 6 lety +6

    I like your videos. Thanks a lot for sharing your knowledge!!!

  • @rico5146
    @rico5146 Před 5 lety +13

    Hi sir ! Thanks for the gorgeous video.
    I’ve noticed some wrong point in your video.
    You explained how many MST can have the differ shape as formual E C (V-1) - no.cycle
    But I think this is wrong and I think it should be fixed this way.
    E C (V-1) -(Number of graphs containing cycles by selecting V-1 edge on E edge)
    So, 7C5-(7) = 14.

    • @abielkim960
      @abielkim960 Před 2 lety +3

      Yes I noticed this too. I was quite stuck on it but I'm glad someone else caught it.

    • @saikiranpandilla6329
      @saikiranpandilla6329 Před 2 lety

      thanks but how did you get as no of cycles=7?

  • @Pooja-xu4lp
    @Pooja-xu4lp Před 3 lety

    Dear Abdul, you win the hearts and i'm rooting for becoming your life long PATREON. Much respect and love on your way.

  • @pythonical2927
    @pythonical2927 Před 5 lety +2

    Sir you are truly amazing. Your explanations are so crystal clear. Thank you very much.

  • @plectro3332
    @plectro3332 Před rokem +3

    I would like to give my thanks to you. I am a tutor at a university where I teach these topics. I often refer to your videos for inspiration on how to teach well and make sure students understand. Your explanations are wonderful and they make the topics seem so simple. Too many lecturers make these things seem complex but in their essence they can be quite simple when explained well. I often teach your way and students are thrilled. I also often recommend your videos and point the students here as well. Thank you for being a wonderful example on how education should be done!

  • @mayurmuley1495
    @mayurmuley1495 Před 5 lety +6

    I never understood Algorithms in college, but you made it so easy, thank you Sir

  • @user-nr4pj6xr3t
    @user-nr4pj6xr3t Před 4 měsíci +1

    This is the first video I have watched of yours, but I give you the title of best teacher, which you deserve

  • @eva42sh
    @eva42sh Před rokem +1

    thank you Mr Abdul for allocating your time for making these awesome educational videos

  • @ramfattah275
    @ramfattah275 Před 2 lety +3

    Proud to be taught by computer science professor Abdul Bari Mohammed.

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

    Brilliant explanation of both algorithms. I wish you are my teacher of data structure.

  • @miltonhuynh4209
    @miltonhuynh4209 Před rokem

    You have an amazing ability to make these concepts make sense to anyone, I will always watch your videos first

  • @ekarata.361
    @ekarata.361 Před rokem

    An easy concept that most professor fails to explain. Thank you for showing how it should be done.

  • @Hritikmaster
    @Hritikmaster Před 5 lety +4

    Sir these videos are awesome ! Perfect explanation.

  • @anuuanuu83
    @anuuanuu83 Před 6 lety +4

    Thank u Sir u are awesome ur vedios are sooo nice nd easy to understand

  • @aqshay
    @aqshay Před 5 měsíci +1

    Absolutely love your English and the way you articulate.

  • @guliyevshahriyar
    @guliyevshahriyar Před 11 měsíci +1

    Thank you very much teacher. The thorough knowledge you provide is most effective tool. Looks forward to watch entire series.

  • @Sagarrameshb
    @Sagarrameshb Před 7 měsíci +4

    Tomorrow morning is DAA exam
    Thank you so much sir 🙏❤

  • @chandrimad5776
    @chandrimad5776 Před 6 lety +2

    Excellent! You don't know sir how have you helped me! I passed graduation long back and now I have no books with me, and have forgotten all these algorithms. Your videos helped me to prepare for the interview I have after 2 days. Thank you so much!

    • @chandrimad5776
      @chandrimad5776 Před 6 lety

      Thank you so much Sir! It went good. Much grateful to you. :)

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

      @@chandrimad5776 bit late but congrats!

  • @sugandhasrivastava7816
    @sugandhasrivastava7816 Před 5 lety +1

    Your way to teaching is very easy n convenient ..thank you sir!💜

  • @sahanashreeg611
    @sahanashreeg611 Před 7 měsíci +1

    We are happy to get teacher like u sir even we are not offline also u became a good teacher through the online for us if the explanation is so long also u explained step by step I didn't see lecture like u who explain in deep like u sir thank you sir

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

    Sir , I have understand the concepts that are teach by you. You made the learning so easy sir

  • @abhishek-kapoor
    @abhishek-kapoor Před 4 lety +7

    1:00 MST
    7:55 prim's algo
    11:34 Kruskals Algorithms

  • @ya00278
    @ya00278 Před 3 lety

    I can't appreciate you enough! Your explanation is super super clear.

  • @owaisahussain
    @owaisahussain Před 4 měsíci +1

    What a rare gem from my neighbourhood this guy. A legendary tutor, who has for sure helped millions of CS in graduating. And who gets the credit?

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

      wdym by neighbourhood?

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

      @@believer8754 He is from India. I am from Pakistan.

  • @gabrielraphaelgarciamontoy1269

    Amazing, thank you!

  • @steveo5946
    @steveo5946 Před 2 lety +3

    Another great video Mr. Bari! One more cookie for you! :-)

  • @alexcruz8024
    @alexcruz8024 Před 2 lety

    This is honestly a way better introduction than the one my professor and ta gave us. Learning all further topics from this guy.

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

    watching this 1 hour before my operational research exam :) thanks a lot sir!!

  • @MadMaXxFx
    @MadMaXxFx Před 5 lety +9

    Compared To U My Teacher Is Some Kg Student... Your Explanations .... No Words.... I Wish we Had Someone Like You To Teach Us

    • @llliiilll3624
      @llliiilll3624 Před 4 lety

      Always respect your teachers, if your preferred way of understanding doesn't align with their way of teaching then just watch lectures online, there's no need to be bitter about it. Successful people have always respected their mentors no matter what.

    • @MadMaXxFx
      @MadMaXxFx Před 4 lety

      @@llliiilll3624 Just compared the levels of teaching of both of em, this doesn't mean i am not respecting my teachers or elders, don't drive into conclusions so fast.

    • @llliiilll3624
      @llliiilll3624 Před 4 lety

      @@MadMaXxFx Oh okay, you said KG student so I got the wrong impression. Sorry about that.

    • @MadMaXxFx
      @MadMaXxFx Před 4 lety

      @@llliiilll3624 Regret Saying That, But This Guy Teaches Like You Teach Alphabets, My Joy Made That Comparison 😁.

  • @VaaniChannel
    @VaaniChannel Před 3 lety +3

    you're the best teacher 🔥

  • @anubhutideshmukh583
    @anubhutideshmukh583 Před 5 lety +2

    Sir your way of teaching is really exceptional.
    Its awesome.

  • @zaffarali5877
    @zaffarali5877 Před 3 lety

    very easy to understand, simple way of learning step by step, Simple English, no background sound. very thankful to you Sir

  • @shubhamchavan6827
    @shubhamchavan6827 Před 5 lety +3

    Sir, which edge to select in the beginning if there are multiple minimum edges of the same cost scattered around the tree? Thank You.

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

    Thank you for this great tutorial. I discovered that for the last example you gave Prim's MST cost was 14 and Kruskal's was 12. Does that mean Kruskal can do better than Prim's? Thanks always

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

    sir with respect your teaching method is outstanding

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

    underrated gem

  • @osmankhalid2005
    @osmankhalid2005 Před 3 lety +3

    It can't be explained any better than this.

  • @suhailakhtar1707
    @suhailakhtar1707 Před 5 lety +6

    i don't know why it took me so hard to find you

  • @vandanadk9314
    @vandanadk9314 Před 3 lety +2

    Feels like he the teacher who I have been looking for throughout my +1 and +2 journey. And my percentage would go high back then...
    Thank You Sir,
    Guys and gals watching Abdul Sir's video kindly: LIKE, SUBSCRIBE, AND share with good people in need like you.

  • @MegaGemoroy
    @MegaGemoroy Před 3 lety

    Mr Bari has come to the rescue once again. Thank you so much for the explanation. I hope you and your close ones are safe in this difficult time.

  • @noorunnisa5912
    @noorunnisa5912 Před 5 lety +3

    Thnk q sir....nice explanation