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
    ---------------------------------------------------------------------------------------------------------------------------

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

  • @takeUforward
    @takeUforward  ปีที่แล้ว +104

    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 หลายเดือนก่อน +119

    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. 🙏😌

  • @sohailshaik9
    @sohailshaik9 ปีที่แล้ว +163

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

    • @yashkagi5399
      @yashkagi5399 ปีที่แล้ว +28

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

    • @vm1662
      @vm1662 11 หลายเดือนก่อน +9

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

    • @movieskingdom1748
      @movieskingdom1748 10 หลายเดือนก่อน +15

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

    • @shubhamkumar-hx1fb
      @shubhamkumar-hx1fb 3 หลายเดือนก่อน +1

      ​@@yashkagi5399😂

    • @shubhamkumar-hx1fb
      @shubhamkumar-hx1fb 3 หลายเดือนก่อน +3

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

  • @valarmorghulis9244
    @valarmorghulis9244 11 หลายเดือนก่อน +78

    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 TH-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 หลายเดือนก่อน +2

      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 :)

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

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

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

    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.

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

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

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

    Exceptional content on TH-cam. Hats Off

  • @animeshmondal9569
    @animeshmondal9569 ปีที่แล้ว +20

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

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

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

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

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

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

    Understood . Great to have people like you

  • @arunimachakraborty1175
    @arunimachakraborty1175 3 หลายเดือนก่อน

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

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

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

  • @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.

  • @cool.kunalsikri
    @cool.kunalsikri ปีที่แล้ว +49

    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!

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

      can you please lmk w/ which job you started?

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

      same with me.

    • @musharrafhussain130
      @musharrafhussain130 11 หลายเดือนก่อน

      systumm!

    • @rollercoaster9719
      @rollercoaster9719 10 หลายเดือนก่อน +13

      now the biggest qn is, how the hell did u get a job if u never did coding in college

    • @shibainu7500
      @shibainu7500 4 หลายเดือนก่อน

      @@rollercoaster9719 Aisa hi hota tha

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

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

  • @g51661
    @g51661 9 หลายเดือนก่อน

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

  • @U2011-n7w
    @U2011-n7w ปีที่แล้ว +1

    your graph series is best on youtube

  • @shubhiagarwal4047
    @shubhiagarwal4047 3 หลายเดือนก่อน

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

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

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

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

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

  • @vishious14
    @vishious14 8 หลายเดือนก่อน

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

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

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

  • @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 🙂

  • @SachinKumar-zs6hm
    @SachinKumar-zs6hm 15 วันที่ผ่านมา

    Understood! Thanks a lot Striver.

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

    Thanks for creating this video, wonderful explanation

  • @prashantkumar-oz2in
    @prashantkumar-oz2in ปีที่แล้ว +3

    Now this is quality content.. ❤❤❤

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

    Wow such clear explanation!

  • @Ballistic_Bytes
    @Ballistic_Bytes 7 หลายเดือนก่อน +1

    Brilliant explanation. Loved it.

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

    No one can teach like you!

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

    Fantastic explanation! thanks a lot my man

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

    As always great explanation 🙂

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

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

  • @amitp277
    @amitp277 11 หลายเดือนก่อน

    What a detailed explanation 👏👏

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

    Thanks for this wonderful explanation sir

  • @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.

  • @shitizgoel5027
    @shitizgoel5027 6 หลายเดือนก่อน

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

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

    Great explanation🚀 understood!!

  • @augustinradjou3909
    @augustinradjou3909 5 หลายเดือนก่อน

    Astonishing work!

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

    Understood sir ,thankyou for your support.

  • @shubhiagarwal4047
    @shubhiagarwal4047 3 หลายเดือนก่อน

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

  • @741ibrahim2
    @741ibrahim2 ปีที่แล้ว +8

    Consistency is amazing ✨✨✨✨❤️‍🔥

  • @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.

  • @vikashkumarvlogsnitj
    @vikashkumarvlogsnitj 10 หลายเดือนก่อน

    impressed , subscribed at first video itself.

  • @paragroy5359
    @paragroy5359 6 หลายเดือนก่อน

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

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

    understood ,great explanation

  • @shantipriya370
    @shantipriya370 6 หลายเดือนก่อน

    just wow.. superb explanation..

  • @stith_pragya
    @stith_pragya 6 หลายเดือนก่อน +1

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

  • @user-ic7rn1pr8t
    @user-ic7rn1pr8t 2 หลายเดือนก่อน +1

    What an explanation.
    Hats off🫡

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

    what an explanation!
    THANKYOU

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

    understood striver!!! THANK YOU

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

    You made this topic look very easy thanks

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

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

  • @arnavumarkar8259
    @arnavumarkar8259 11 หลายเดือนก่อน

    Very well explained. Thanks

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

    you inspired me today . Thank you

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

    UnderStood bhaiya...thankYOu soo much

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

    Understood all the stuffs ❤❤

  • @coderunner743
    @coderunner743 3 หลายเดือนก่อน

    clearly understandable thanks

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

    thanks man wow what a lecture

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

    lots of love and respect🙌

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

    understood, love your videos

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

    Amazing explanation

  • @adebisisheriff159
    @adebisisheriff159 5 หลายเดือนก่อน

    Amazing content as always!!!!

  • @AlokSingh-jw8fr
    @AlokSingh-jw8fr ปีที่แล้ว +1

    Understood everything you taught in video.

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

    Awesome Explanation♥

  • @AdityaKumar-be7hx
    @AdityaKumar-be7hx ปีที่แล้ว

    understood. And you are awesome!

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

    best of all !! kudos to you bro

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

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

  • @rushidesai2836
    @rushidesai2836 5 หลายเดือนก่อน

    Very well explained!

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

    Amazing video loved it

  • @user-lc2lp8zb6l
    @user-lc2lp8zb6l 7 หลายเดือนก่อน

    amazingly explained

  • @sayakghosh5104
    @sayakghosh5104 ปีที่แล้ว +14

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

    • @KeshavSingh-yu9jw
      @KeshavSingh-yu9jw ปีที่แล้ว +14

      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.

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

    Thank You Striver💖💖

  • @lingasodanapalli615
    @lingasodanapalli615 11 หลายเดือนก่อน

    Understood very well

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

    Understood bhaiya 🙏❤️

  • @Chandraprakash-kx4ic
    @Chandraprakash-kx4ic ปีที่แล้ว

    Understood...Thank U striver...

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

    very well explained

  • @vigupta-uq1pn
    @vigupta-uq1pn 7 หลายเดือนก่อน

    goldmine for DSA🔥🔥

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

    Thank you so much brother

  • @sobujkhan2602
    @sobujkhan2602 6 หลายเดือนก่อน

    this is amazing application really very nice video

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

    Understood 🙏

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

    this was fantastic..

  • @kb-ru4md
    @kb-ru4md 2 หลายเดือนก่อน +1

    Best videos dp and graph🙏

  • @jk-sm6qr
    @jk-sm6qr 3 หลายเดือนก่อน

    Thank you so much

  • @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 😂😂

  • @anandchauhan1868
    @anandchauhan1868 10 หลายเดือนก่อน

    Thanks for teaching

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

    Understood! ❤️

  • @abhinaviit-bhu7817
    @abhinaviit-bhu7817 ปีที่แล้ว

    Understood!🔥

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

    Understood 🔥🔥

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

    UnderStood Sir🔥🔥

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

    Understood as always :)

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

    understood clearly

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

    Wonderful !!

  • @Alwaysalearner123
    @Alwaysalearner123 10 หลายเดือนก่อน

    Understood 💯

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

    Great video sir

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

    Understood Sir!

  • @surge3.14
    @surge3.14 2 หลายเดือนก่อน

    Awesome!

  • @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!