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

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

Пікірлер: 356

  • @takeUforward
    @takeUforward Жыл бұрын

    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

    2 ай бұрын

    HIndi wala chiye solutions

  • @crazyduniya128
    @crazyduniya128 Жыл бұрын

    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 Жыл бұрын

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

  • @yashkagi5399

    @yashkagi5399

    Жыл бұрын

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

  • @vm1662

    @vm1662

    11 ай бұрын

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

  • @movieskingdom1748

    @movieskingdom1748

    10 ай бұрын

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

  • @shubhamkumar-hx1fb

    @shubhamkumar-hx1fb

    3 ай бұрын

    ​@@yashkagi5399😂

  • @shubhamkumar-hx1fb

    @shubhamkumar-hx1fb

    3 ай бұрын

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

  • @valarmorghulis9244
    @valarmorghulis924411 ай бұрын

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

    3 ай бұрын

    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 Жыл бұрын

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

  • @AbhinavSingh-rl9zr
    @AbhinavSingh-rl9zr9 күн бұрын

    wow literally blown my mind such depth of covering each point with intutition..,.massive amount of practice and hardwork is behind all this..

  • @sanyamjawlia
    @sanyamjawlia Жыл бұрын

    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 Жыл бұрын

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

  • @ashishkumaryadav5252
    @ashishkumaryadav5252 Жыл бұрын

    Exceptional content on KZread. Hats Off

  • @SoniaStalance
    @SoniaStalance Жыл бұрын

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

  • @jayyanthmalepati7584
    @jayyanthmalepati7584 Жыл бұрын

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

  • @arunimachakraborty1175
    @arunimachakraborty11753 ай бұрын

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

  • @aparnakanchi
    @aparnakanchi Жыл бұрын

    Understood . Great to have people like you

  • @mihirsaini592
    @mihirsaini592 Жыл бұрын

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

  • @animeshmondal9569
    @animeshmondal9569 Жыл бұрын

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

  • @cool.kunalsikri
    @cool.kunalsikri Жыл бұрын

    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

    Жыл бұрын

    can you please lmk w/ which job you started?

  • @varunaggarwal7126

    @varunaggarwal7126

    Жыл бұрын

    same with me.

  • @musharrafhussain130

    @musharrafhussain130

    11 ай бұрын

    systumm!

  • @rollercoaster9719

    @rollercoaster9719

    10 ай бұрын

    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

  • @kritikarawat2180
    @kritikarawat2180 Жыл бұрын

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

  • @Dontpushyour_luck
    @Dontpushyour_luck Жыл бұрын

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

  • @U2011-n7w
    @U2011-n7w Жыл бұрын

    your graph series is best on youtube

  • @vishious14
    @vishious148 ай бұрын

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

  • @g51661
    @g516619 ай бұрын

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

  • @shubhiagarwal4047
    @shubhiagarwal40473 ай бұрын

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

  • @vishalbindal5066
    @vishalbindal5066 Жыл бұрын

    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
    @rohan87582 ай бұрын

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

  • @sarankumaar6009
    @sarankumaar6009 Жыл бұрын

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

  • @evilpollination1916
    @evilpollination19162 ай бұрын

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

  • @utkarshsingh7197
    @utkarshsingh7197 Жыл бұрын

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

  • @prashantkumar-oz2in
    @prashantkumar-oz2in Жыл бұрын

    Now this is quality content.. ❤❤❤

  • @SachinKumar-zs6hm
    @SachinKumar-zs6hm27 күн бұрын

    Understood! Thanks a lot Striver.

  • @vijayarana2087
    @vijayarana2087 Жыл бұрын

    Thanks for creating this video, wonderful explanation

  • @uavishal777
    @uavishal777 Жыл бұрын

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

  • @augustinradjou3909
    @augustinradjou39095 ай бұрын

    Astonishing work!

  • @mordor2594
    @mordor25944 ай бұрын

    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.

  • @741ibrahim2
    @741ibrahim2 Жыл бұрын

    Consistency is amazing ✨✨✨✨❤️‍🔥

  • @oqant0424
    @oqant0424 Жыл бұрын

    No one can teach like you!

  • @suryasingh2563
    @suryasingh2563 Жыл бұрын

    UnderStood bhaiya...thankYOu soo much

  • @devchaudhary5002
    @devchaudhary5002 Жыл бұрын

    Fantastic explanation! thanks a lot my man

  • @Ballistic_Bytes
    @Ballistic_Bytes7 ай бұрын

    Brilliant explanation. Loved it.

  • @codingid5470
    @codingid5470 Жыл бұрын

    Wow such clear explanation!

  • @rohitn6333
    @rohitn6333 Жыл бұрын

    Thanks for this wonderful explanation sir

  • @vaishnavimore4860
    @vaishnavimore4860 Жыл бұрын

    Great explanation🚀 understood!!

  • @shubhiagarwal4047
    @shubhiagarwal40473 ай бұрын

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

  • @user-ic7rn1pr8t
    @user-ic7rn1pr8t2 ай бұрын

    What an explanation. Hats off🫡

  • @shitizgoel5027
    @shitizgoel50276 ай бұрын

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

  • @sunilpanchal1498
    @sunilpanchal1498 Жыл бұрын

    As always great explanation 🙂

  • @ritwikamahapatra1432
    @ritwikamahapatra14323 ай бұрын

    what an explanation! THANKYOU

  • @reshusingh3558
    @reshusingh3558 Жыл бұрын

    Understood sir ,thankyou for your support.

  • @paragroy5359
    @paragroy53596 ай бұрын

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

  • @adebisisheriff159
    @adebisisheriff1596 ай бұрын

    Amazing content as always!!!!

  • @amitp277
    @amitp277 Жыл бұрын

    What a detailed explanation 👏👏

  • @vikashkumarvlogsnitj
    @vikashkumarvlogsnitj10 ай бұрын

    impressed , subscribed at first video itself.

  • @shubhrabrahmachari7649
    @shubhrabrahmachari7649Ай бұрын

    you inspired me today . Thank you

  • @AlokSingh-jw8fr
    @AlokSingh-jw8fr Жыл бұрын

    Understood everything you taught in video.

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

  • @stith_pragya
    @stith_pragya7 ай бұрын

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

  • @viraag8667
    @viraag8667Ай бұрын

    You made this topic look very easy thanks

  • @achyutpal6225
    @achyutpal6225 Жыл бұрын

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

  • @prasannasippa5962
    @prasannasippa5962 Жыл бұрын

    understood striver!!! THANK YOU

  • @herculean6748
    @herculean6748 Жыл бұрын

    lots of love and respect🙌

  • @rishabhgupta9846
    @rishabhgupta9846 Жыл бұрын

    understood ,great explanation

  • @shantipriya370
    @shantipriya3706 ай бұрын

    just wow.. superb explanation..

  • @saniyapathan8968
    @saniyapathan896810 күн бұрын

    You are the best🙌

  • @AdityaKumar-be7hx
    @AdityaKumar-be7hx Жыл бұрын

    understood. And you are awesome!

  • @vaibhavsharmaiiitu9319
    @vaibhavsharmaiiitu9319 Жыл бұрын

    Amazing video loved it

  • @arnavumarkar8259
    @arnavumarkar825911 ай бұрын

    Very well explained. Thanks

  • @andresfgalvis2010
    @andresfgalvis2010 Жыл бұрын

    understood, love your videos

  • @adityarai30
    @adityarai30 Жыл бұрын

    Awesome Explanation♥

  • @abhishekkuntare4640
    @abhishekkuntare4640 Жыл бұрын

    Understood all the stuffs ❤❤

  • @rushidesai2836
    @rushidesai28366 ай бұрын

    Very well explained!

  • @udaytewary3809
    @udaytewary3809 Жыл бұрын

    Understood bhaiya 🙏❤️

  • @sayakghosh5104
    @sayakghosh5104 Жыл бұрын

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

  • @KeshavSingh-yu9jw

    @KeshavSingh-yu9jw

    Жыл бұрын

    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

    Жыл бұрын

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

  • @krishanpratap3286

    @krishanpratap3286

    Жыл бұрын

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

  • @sayakghosh5104

    @sayakghosh5104

    Жыл бұрын

    @@krishanpratap3286 3rd Year. 🙂

  • @KeshavSingh-yu9jw

    @KeshavSingh-yu9jw

    Жыл бұрын

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

  • @gunahawk6893
    @gunahawk6893 Жыл бұрын

    thanks man wow what a lecture

  • @virgarg9653
    @virgarg9653 Жыл бұрын

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

  • @sumerrawat6947
    @sumerrawat6947 Жыл бұрын

    Amazing explanation

  • @Shubham_gupta18
    @Shubham_gupta183 ай бұрын

    best of all !! kudos to you bro

  • @beinginnit
    @beinginnit Жыл бұрын

    Thank You Striver💖💖

  • @itspurelypassionate
    @itspurelypassionate10 ай бұрын

    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!

  • @abhinaviit-bhu7817
    @abhinaviit-bhu7817 Жыл бұрын

    Understood!🔥

  • @cypher7536
    @cypher7536 Жыл бұрын

    Understood! ❤️

  • @Chandraprakash-kx4ic
    @Chandraprakash-kx4ic Жыл бұрын

    Understood...Thank U striver...

  • @kr_ankit123
    @kr_ankit123 Жыл бұрын

    Understood as always :)

  • @lingasodanapalli615
    @lingasodanapalli615 Жыл бұрын

    Understood very well

  • @user-lc2lp8zb6l
    @user-lc2lp8zb6l8 ай бұрын

    amazingly explained

  • @kb-ru4md
    @kb-ru4md2 ай бұрын

    Best videos dp and graph🙏

  • @Shivanai_h
    @Shivanai_h Жыл бұрын

    Understood 🙏

  • @surge3.14
    @surge3.142 ай бұрын

    Awesome!

  • @saiyamanand1387
    @saiyamanand1387 Жыл бұрын

    The content💯🔥

  • @coderunner743
    @coderunner7433 ай бұрын

    clearly understandable thanks

  • @vigupta-uq1pn
    @vigupta-uq1pn7 ай бұрын

    goldmine for DSA🔥🔥

  • @anubhavjasoria4335
    @anubhavjasoria4335 Жыл бұрын

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

  • @krishanpratap3286

    @krishanpratap3286

    Жыл бұрын

    which year u at?

  • @ashishdhal4614

    @ashishdhal4614

    Жыл бұрын

    Bhai kou college

  • @original_gangsta_
    @original_gangsta_ Жыл бұрын

    Understood 🔥🔥

  • @CharanSaiAnnam
    @CharanSaiAnnam Жыл бұрын

    Wonderful !!

  • @komalkrishna7836
    @komalkrishna7836 Жыл бұрын

    Understood!

  • @AngadSingh97
    @AngadSingh97 Жыл бұрын

    this was fantastic..

  • @sravansatapathi813
    @sravansatapathi8134 ай бұрын

    Understood❤

  • @Alwaysalearner123
    @Alwaysalearner12311 ай бұрын

    Understood 💯

  • @jaswinders2670
    @jaswinders2670 Жыл бұрын

    very well explained

  • @sobujkhan2602
    @sobujkhan26026 ай бұрын

    this is amazing application really very nice video

  • @parshchoradia9909
    @parshchoradia9909 Жыл бұрын

    Understood Sir!

  • @mihirsaini592
    @mihirsaini592 Жыл бұрын

    Thank you so much brother