G-46. Disjoint Set | Union by Rank | Union by Size | Path Compression

Поділитися
Вставка
  • Опубліковано 21 жов 2022
  • In this video, I have shown you such a code snippet, which can solve any problem on Disjoint Set on any platform.
    C++ Code Snippet of DS: ide.geeksforgeeks.org/392f3f8...
    Java Code Snippet of DS: ide.geeksforgeeks.org/fde794b...
    C++/Java/Codes and Notes Link: takeuforward.org/data-structu...
    DP Series: • Striver's Dynamic Prog...
    SDE Sheet: takeuforward.org/interviews/s...
    Check out our Website for curated resources:
    Our Second Channel: / @striver_79
    In case you are thinking to buy courses, please check below:
    Code "takeuforward" for 15% off at GFG: practice.geeksforgeeks.org/co...
    Code "takeuforward" for 20% off on sys-design: get.interviewready.io?_aff=takeuforward
    Crypto, I use the Wazirx app: wazirx.com/invite/xexnpc4u
    Take 750 rs free Amazon Stock from me: indmoney.onelink.me/RmHC/idje...
    Earn 100 rs by making a Grow Account for investing: app.groww.in/v3cO/8hu879t0
    Linkedin/Instagram/Telegram: linktr.ee/takeUforward
    ---------------------------------------------------------------------------------------------------------------------------

КОМЕНТАРІ • 341

  • @takeUforward
    @takeUforward  Рік тому +101

    Let's continue the habit of commenting “understood” if you got the entire video. Please give it a like too,.
    Do follow me on Instagram: striver_79

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

      Hi, During example explanation, you have mentioned to update parent of u or parent of v depending on rank of parent of u and v. but in code you are updating parent[ulp_u] which is parent of ultimate parent of u at 29:19. Can you please clarify why is this difference.

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

      java ka code likh k kya hi matlab , jab aap samjhate nhi , jesaa c++ ka code likhte ho vesaa live java ka likha rao app plz ,, c++ ka code side me chika diya karo , c++ community bahut badi hai , woh help leke manage kr lenge ,, but java walo ka kya ??

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

      ​@@cartube6219 bro both java and c++ are almost same , there are only some minor syntax difference.

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

      Understood

    • @abhinavgupta8839
      @abhinavgupta8839 Місяць тому +1

      HIndi wala chiye solutions

  • @crazyduniya128
    @crazyduniya128 11 місяців тому +110

    Me looking here nd there while video is playing, then suddenly I looked at the striver's face and found that he is more serious about my career then I myself. This motivated me and my focus boosted. Thank you striver. 🙏😌

  • @valarmorghulis9244
    @valarmorghulis9244 10 місяців тому +73

    This was the toughest topic in Graph. So in case someone finds it difficult to understand while watching it for the first time. I suggest you to watch the next few videos and come back and do some brainstorming and then again see this video. I tell you this because it worked for me. And clearly no other videos have this depth explanation on UA-cam. You will know how beautifully Striver has explained once the working of Disjoint Sets starts ticking your mind. Just watch some of the next videos and then come back and watch this.

    • @lavanyam3224
      @lavanyam3224 2 місяці тому +1

      yes you're right, after watching the next few videos, it makes more sense. I also watched Tushar roy's video on Disjoint sets, it helped too :)

  • @sohailshaik9
    @sohailshaik9 Рік тому +155

    Watching this video after watching Abdul Bari sir's video. Both are legends in their own way. Great learning ❤️

    • @yashkagi5399
      @yashkagi5399 Рік тому +27

      i used to watch abdul bari's video for sleeping as his voice is very monotonous

    • @vm1662
      @vm1662 11 місяців тому +8

      Same! I just watched Abdul Bari sir's video and now watching Striver. These two are blessings to CS students.

    • @movieskingdom1748
      @movieskingdom1748 9 місяців тому +14

      Khud se bhi karle bhai..sirf video dekhne se kuch ni hota.

    • @shubhamkumar-hx1fb
      @shubhamkumar-hx1fb 3 місяці тому

      ​@@yashkagi5399😂

    • @shubhamkumar-hx1fb
      @shubhamkumar-hx1fb 3 місяці тому +1

      ​@@movieskingdom1748 khud se questions kiye jate Hain algos ke to videos hi dekhne padte hain 😂

  • @tiyashaghosh9933
    @tiyashaghosh9933 11 місяців тому +6

    The more I see his videos, his work, the more I respect him.

  • @sanyamjawlia
    @sanyamjawlia Рік тому +2

    Please bring such more series of other topics as well. These series are too amazing and easy to understand. Loved your way of teaching as well.

  • @cool.kunalsikri
    @cool.kunalsikri Рік тому +48

    In college, i never did coding even though i was in Cse branch. Because i never liked competetive programming. But after coming into tech industry, i started liking to code and solve problems. So i have started learning various ds and i must say the content u have created is awesome. I love it .Awesome explanations . Thanks brother!

  • @cinime
    @cinime Рік тому +4

    Understood! Such an awesome explanation as always, thank you very much!!

  • @SoniaStalance
    @SoniaStalance Рік тому +7

    Wow! That was one of the best tutorials I've ever seen.

  • @animeshmondal9569
    @animeshmondal9569 Рік тому +20

    UnderStood Sir🔥🔥 No one can teach like you 😎😎..

  • @jayyanthmalepati7584
    @jayyanthmalepati7584 Рік тому +3

    I did understood the class partially not fully but striver's videos have a good content .literally he is my trainer

  • @ashishkumaryadav5252
    @ashishkumaryadav5252 Рік тому +12

    Exceptional content on UA-cam. Hats Off

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

    Watched it again after 5 months, can't thank you enough my man

  • @arunimachakraborty1175
    @arunimachakraborty1175 2 місяці тому

    This concept was quite complicated and you, as always, made it look so easy. Thanks a lot!

  • @aparnakanchi
    @aparnakanchi Рік тому +2

    Understood . Great to have people like you

  • @Dontpushyour_luck
    @Dontpushyour_luck Рік тому +1

    This was such a nice video. Thank you for teaching all this for free!

  • @kritikarawat2180
    @kritikarawat2180 Рік тому +4

    Impressive man.I understood all concepts told in this video.

  • @g51661
    @g51661 8 місяців тому

    I wish I could hit the like button a thousand times! Thank you, Striver

  • @shubhiagarwal4047
    @shubhiagarwal4047 2 місяці тому

    Understood.
    Striver Sir, this is great to launch dp and graph series. No teacher can do better dry run of the logic like you.

  • @utkarshpatel949
    @utkarshpatel949 Рік тому +1

    your graph series is best on youtube

  • @vishalbindal5066
    @vishalbindal5066 Рік тому +2

    Through this video i am able to understand dsu properly before this i go through various videos and articles but don't get it like after this video thanks bhaiya 🙂

  • @rohan8758
    @rohan8758 Місяць тому

    Understood! Such an awesome explanation as always, thank you very much!!🤓

  • @vishious14
    @vishious14 7 місяців тому

    THIS WAS THE BEST EXPLANATION OF DISJOINT SET. OMG !!!!!!!

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

    Teaching with such a fluency.....Big Fan Sir!!

  • @sarankumaar6009
    @sarankumaar6009 Рік тому +1

    understood. best best best explanation. no one can match this ever

  • @SachinKumar-zs6hm
    @SachinKumar-zs6hm 6 днів тому

    Understood! Thanks a lot Striver.

  • @evilpollination1916
    @evilpollination1916 Місяць тому

    As always amazing video. Understood everything but had to watch twice.

  • @prashantkumar-oz2in
    @prashantkumar-oz2in Рік тому +3

    Now this is quality content.. ❤❤❤

  • @augustinradjou3909
    @augustinradjou3909 4 місяці тому

    Astonishing work!

  • @mordor2594
    @mordor2594 4 місяці тому

    This is the first topic I had to refer some other resource to understand after your video. I love your content but this was the only time I had to go to some other place to understand the concept.

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

    No one can teach like you!

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

    Fantastic explanation! thanks a lot my man

  • @741ibrahim2
    @741ibrahim2 Рік тому +8

    Consistency is amazing ✨✨✨✨❤️‍🔥

  • @uavishal777
    @uavishal777 Рік тому +1

    Striver bhaiya you are legend for us🔥🔥.i wish that anytime i could meet you.

  • @vijayarana2087
    @vijayarana2087 Рік тому +1

    Thanks for creating this video, wonderful explanation

  • @shubhiagarwal4047
    @shubhiagarwal4047 2 місяці тому

    Not a single dislike shows, a man with no hatred only respect.

  • @Ballistic_Bytes
    @Ballistic_Bytes 6 місяців тому +1

    Brilliant explanation. Loved it.

  • @sayakghosh5104
    @sayakghosh5104 Рік тому +14

    One of the toughest topics in DSA, I've learned till now, DP was much easier. 🙂🙂🙂🙂🙂🙂

    • @KeshavSingh-yu9jw
      @KeshavSingh-yu9jw Рік тому +13

      Maybe you learned about disjoint joint first time today, It all comes down to practice. After some practice you will find it easier(that's the case with me). So lets keep grinding.

    • @sayakghosh5104
      @sayakghosh5104 Рік тому +1

      @@KeshavSingh-yu9jw yes today itself... Let's grind 😊

    • @krishanpratap3286
      @krishanpratap3286 Рік тому +1

      hey it will be easy once u solve some que with this /
      btw which year ?

    • @sayakghosh5104
      @sayakghosh5104 Рік тому +1

      @@krishanpratap3286 3rd Year. 🙂

    • @KeshavSingh-yu9jw
      @KeshavSingh-yu9jw Рік тому +1

      @@sayakghosh5104 I am in 3rd year as well.

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

    Wow such clear explanation!

  • @shitizgoel5027
    @shitizgoel5027 6 місяців тому

    Very nice explanation for union-find algorithm. Thank you very much bhaiya! 🙂

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

    great explanation help me to understand within few minutes at X2 speed, Instead of searching it over internet and spending lot of time.

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

    As always great explanation 🙂

  • @vaishnavimore4860
    @vaishnavimore4860 Рік тому +1

    Great explanation🚀 understood!!

  • @user-ic7rn1pr8t
    @user-ic7rn1pr8t 2 місяці тому +1

    What an explanation.
    Hats off🫡

  • @amitp277
    @amitp277 11 місяців тому

    What a detailed explanation 👏👏

  • @rohitn6333
    @rohitn6333 Рік тому +2

    Thanks for this wonderful explanation sir

  • @suryasingh2563
    @suryasingh2563 Рік тому +1

    UnderStood bhaiya...thankYOu soo much

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

    Understood sir ,thankyou for your support.

  • @adebisisheriff159
    @adebisisheriff159 5 місяців тому

    Amazing content as always!!!!

  • @ritwikamahapatra1432
    @ritwikamahapatra1432 2 місяці тому

    what an explanation!
    THANKYOU

  • @AlokSingh-jw8fr
    @AlokSingh-jw8fr Рік тому +1

    Understood everything you taught in video.

  • @paragroy5359
    @paragroy5359 6 місяців тому

    Thanks a lot for making such videos it is really helpful.
    Great Content

  • @viraag8667
    @viraag8667 Місяць тому

    You made this topic look very easy thanks

  • @vikashkumarvlogsnitj
    @vikashkumarvlogsnitj 9 місяців тому

    impressed , subscribed at first video itself.

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

    lots of love and respect🙌

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

    understood striver!!! THANK YOU

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

    understood ,great explanation

  • @AdityaKumar-be7hx
    @AdityaKumar-be7hx Рік тому

    understood. And you are awesome!

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

    understood, love your videos

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

    Understood! ❤️

  • @abhinaviit-bhu7817
    @abhinaviit-bhu7817 Рік тому

    Understood!🔥

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

    Understood all the stuffs ❤❤

  • @shantipriya370
    @shantipriya370 5 місяців тому

    just wow.. superb explanation..

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

    Understood very well.
    Thank you 😄😄😄😄😄😄,

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

    Awesome Explanation♥

  • @anubhavjasoria4335
    @anubhavjasoria4335 Рік тому +3

    Bhai love from odisha ….i have been following you since last year and i feel so confident about the topics that I learned from you ….. “ KEI DINA DEKHA HABA “ - my goal 😂😂

  • @itspurelypassionate
    @itspurelypassionate 10 місяців тому +1

    Thank you! This is is the best explanation of Disjoint Set I've come across. By the way I have a request for one other video. Can you please upload a video explaining leetcode 992 problem. I tried to understand through other channels but I didn't get it. The problem asks us to find the number of subarrays with exact K different integers. Thanks!

  • @arnavumarkar8259
    @arnavumarkar8259 11 місяців тому

    Very well explained. Thanks

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

    Amazing explanation

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

    Understood Very good bro keep it up .....

  • @shubhrabrahmachari7649
    @shubhrabrahmachari7649 Місяць тому

    you inspired me today . Thank you

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

    thanks man wow what a lecture

  • @stith_pragya
    @stith_pragya 6 місяців тому +1

    Thank You So Much for this wonderful video...................🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

  • @vaibhavsharmaiiitu9319
    @vaibhavsharmaiiitu9319 Рік тому +1

    Amazing video loved it

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

    Understood bhaiya 🙏❤️

  • @Shivanai_h
    @Shivanai_h Рік тому +1

    Understood 🙏

  • @rushidesai2836
    @rushidesai2836 5 місяців тому

    Very well explained!

  • @vigupta-uq1pn
    @vigupta-uq1pn 7 місяців тому

    goldmine for DSA🔥🔥

  • @Shubham_gupta18
    @Shubham_gupta18 2 місяці тому

    best of all !! kudos to you bro

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

    Understood as always :)

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

    Thank You Striver💖💖

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

    Understood 🔥🔥

  • @coderunner743
    @coderunner743 3 місяці тому

    clearly understandable thanks

  • @Alwaysalearner123
    @Alwaysalearner123 10 місяців тому

    Understood 💯

  • @komalkrishna7836
    @komalkrishna7836 Рік тому +1

    Understood!

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

    Wonderful !!

  • @Chandraprakash-kx4ic
    @Chandraprakash-kx4ic Рік тому

    Understood...Thank U striver...

  • @lingasodanapalli615
    @lingasodanapalli615 11 місяців тому

    Understood very well

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

    The content💯🔥

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

    Understood Sir!

  • @user-lc2lp8zb6l
    @user-lc2lp8zb6l 7 місяців тому

    amazingly explained

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

    UnderStood Sir🔥🔥

  • @surge3.14
    @surge3.14 2 місяці тому

    Awesome!

  • @-VLaharika
    @-VLaharika Рік тому

    Understood 👍

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

    crystal clear

  • @kb-ru4md
    @kb-ru4md 2 місяці тому +1

    Best videos dp and graph🙏

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

    Understood🏁

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

    very well explained

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

    Thank you so much brother

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

    Understood❤