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

  Рет қаралды 333,975

take U forward

take U forward

Күн бұрын

Пікірлер: 437
@takeUforward
@takeUforward 2 жыл бұрын
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 2 жыл бұрын
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 8 ай бұрын
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. 🙏😌
@YashMezzala
@YashMezzala 3 ай бұрын
cringe
@humanity7880
@humanity7880 3 ай бұрын
@@YashMezzala Okay Dank boi
@valarmorghulis9244
@valarmorghulis9244 Жыл бұрын
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 KZbin. 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.
@lavanya_m01
@lavanya_m01 9 ай бұрын
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 :)
@RahulPatel-hr4qe
@RahulPatel-hr4qe 5 ай бұрын
Yes ! Same happend with me in BFS and DFS , Intitally overwhelmed by it , came back after few days and back got it within one chancce
@praveenkumarp7150
@praveenkumarp7150 Ай бұрын
Reading his article before this video will also help.
@sohailshaik9
@sohailshaik9 2 жыл бұрын
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 Жыл бұрын
Same! I just watched Abdul Bari sir's video and now watching Striver. These two are blessings to CS students.
@movieskingdom1748
@movieskingdom1748 Жыл бұрын
Khud se bhi karle bhai..sirf video dekhne se kuch ni hota.
@shubhamkumar-hx1fb
@shubhamkumar-hx1fb 9 ай бұрын
​@@yashkagi5399😂
@shubhamkumar-hx1fb
@shubhamkumar-hx1fb 9 ай бұрын
​@@movieskingdom1748 khud se questions kiye jate Hain algos ke to videos hi dekhne padte hain 😂
@AnushkaGupta-x6w
@AnushkaGupta-x6w 2 ай бұрын
This was the topic due to which I once got rejected at Google, And Now I can proudly say that this is the topic that is the reason that I got an offer from UBER 🎉🎉. THANKS STRIVER❤ Was a long journey but it was all worth it.
@tiyashaghosh9933
@tiyashaghosh9933 Жыл бұрын
The more I see his videos, his work, the more I respect him.
@KeigoEdits
@KeigoEdits 5 ай бұрын
25:29 is such a wholesome reaction of striver lol, like a relative is giving you some money before leaving
@cool.kunalsikri
@cool.kunalsikri 2 жыл бұрын
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 Жыл бұрын
systumm!
@rollercoaster9719
@rollercoaster9719 Жыл бұрын
now the biggest qn is, how the hell did u get a job if u never did coding in college
@shibainu7500
@shibainu7500 10 ай бұрын
@@rollercoaster9719 Aisa hi hota tha
@arunimachakraborty1175
@arunimachakraborty1175 9 ай бұрын
This concept was quite complicated and you, as always, made it look so easy. Thanks a lot!
@shubhiagarwal4047
@shubhiagarwal4047 9 ай бұрын
Understood. Striver Sir, this is great to launch dp and graph series. No teacher can do better dry run of the logic like you.
@animeshmondal9569
@animeshmondal9569 2 жыл бұрын
UnderStood Sir🔥🔥 No one can teach like you 😎😎..
@AbhinavSingh-rl9zr
@AbhinavSingh-rl9zr 6 ай бұрын
wow literally blown my mind such depth of covering each point with intutition..,.massive amount of practice and hardwork is behind all this..
@SoniaStalance
@SoniaStalance Жыл бұрын
Wow! That was one of the best tutorials I've ever seen.
@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.
@ashishkumaryadav5252
@ashishkumaryadav5252 2 жыл бұрын
Exceptional content on KZbin. Hats Off
@shubhiagarwal4047
@shubhiagarwal4047 9 ай бұрын
Not a single dislike shows, a man with no hatred only respect.
@jayyanthmalepati7584
@jayyanthmalepati7584 Жыл бұрын
I did understood the class partially not fully but striver's videos have a good content .literally he is my trainer
@g51661
@g51661 Жыл бұрын
I wish I could hit the like button a thousand times! Thank you, Striver
@kishorevb8331
@kishorevb8331 4 ай бұрын
Knowing about the dynamic network connectivity problem really helps out as it is essentially the disjoint set algo is the same as weighted union with path compression
@aparnakanchi
@aparnakanchi Жыл бұрын
Understood . Great to have people like you
@mordor2594
@mordor2594 10 ай бұрын
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.
@U2011-n7w
@U2011-n7w Жыл бұрын
your graph series is best on youtube
@googleit2490
@googleit2490 Жыл бұрын
Understood :) Have to code Sep'3, 2023 05:20 pm Done at Sep'4,2023 11:30 pm
@AbhishekKumar-td5zu
@AbhishekKumar-td5zu 3 ай бұрын
Best explanation of DisJointSet you will ever find ❤
@vishious14
@vishious14 Жыл бұрын
THIS WAS THE BEST EXPLANATION OF DISJOINT SET. OMG !!!!!!!
@anubhavjasoria4335
@anubhavjasoria4335 2 жыл бұрын
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 2 жыл бұрын
which year u at?
@ashishdhal4614
@ashishdhal4614 2 жыл бұрын
Bhai kou college
@741ibrahim2
@741ibrahim2 2 жыл бұрын
Consistency is amazing ✨✨✨✨❤️‍🔥
@sayakghosh5104
@sayakghosh5104 2 жыл бұрын
One of the toughest topics in DSA, I've learned till now, DP was much easier. 🙂🙂🙂🙂🙂🙂
@KeshavSingh-yu9jw
@KeshavSingh-yu9jw 2 жыл бұрын
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 2 жыл бұрын
@@KeshavSingh-yu9jw yes today itself... Let's grind 😊
@krishanpratap3286
@krishanpratap3286 2 жыл бұрын
hey it will be easy once u solve some que with this / btw which year ?
@sayakghosh5104
@sayakghosh5104 2 жыл бұрын
@@krishanpratap3286 3rd Year. 🙂
@KeshavSingh-yu9jw
@KeshavSingh-yu9jw 2 жыл бұрын
@@sayakghosh5104 I am in 3rd year as well.
@atulkumarsingh6507
@atulkumarsingh6507 28 күн бұрын
I watched this video , when it got uploaded (2022) because it was the best at that time. I am watching this video right now (2024) because it is still the best .
@Tbm4545
@Tbm4545 11 күн бұрын
And why u watching in 24 again?
@kritikarawat2180
@kritikarawat2180 Жыл бұрын
Impressive man.I understood all concepts told in this video.
@nishigandhagirishdandekar1131
@nishigandhagirishdandekar1131 4 ай бұрын
Very good explanation! I liked the union by size better than union by rank. It's more intuitive like you said in the video.
@mayurbhor2231
@mayurbhor2231 26 күн бұрын
Learning Union By Rank first made Union by Size look easy and intuitive :)
@prashantkumar-oz2in
@prashantkumar-oz2in Жыл бұрын
Now this is quality content.. ❤❤❤
@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 🙂
@mihirsaini592
@mihirsaini592 Жыл бұрын
Watched it again after 5 months, can't thank you enough my man
@utkarshsingh7197
@utkarshsingh7197 Жыл бұрын
Teaching with such a fluency.....Big Fan Sir!!
@uavishal777
@uavishal777 2 жыл бұрын
Striver bhaiya you are legend for us🔥🔥.i wish that anytime i could meet you.
@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.
@cinime
@cinime 2 жыл бұрын
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
@evilpollination1916 8 ай бұрын
As always amazing video. Understood everything but had to watch twice.
@surabhilakhotia31
@surabhilakhotia31 2 ай бұрын
Thank you sooo much for such detailed and simplified explanation :)
@shitizgoel5027
@shitizgoel5027 Жыл бұрын
Very nice explanation for union-find algorithm. Thank you very much bhaiya! 🙂
@mayurbhor2231
@mayurbhor2231 26 күн бұрын
If you ware wondering what is α(n) is , It is Ackerman's function constant . α(1)=1 𝛼(1012)=4 𝛼(265536)=5 The function grows very slowly , and for all practical applications we can consider it as constant
@21BD1A05R
@21BD1A05R 7 ай бұрын
I find union by rank more intuitive because, without path compression ( i,e, if findPar is not called for any of the nodes ) we can assume rank as the depth of the tree. As Striver mentioned, attaching a smaller depth tree to a larger depth tree is more efficient, and this makes logical sense. In contrast, union by size doesn't provide a clear idea about the tree's depth. When using union by size, we are assuming that a larger size corresponds to a greater depth, which isn't necessarily true in all cases. I would like you to comment your intuition .
@Schrodinger-xd4pv
@Schrodinger-xd4pv 26 күн бұрын
true bud
@Dontpushyour_luck
@Dontpushyour_luck Жыл бұрын
This was such a nice video. Thank you for teaching all this for free!
@AbhilashKumar-x2k
@AbhilashKumar-x2k 8 ай бұрын
What an explanation. Hats off🫡
@suryasingh2563
@suryasingh2563 Жыл бұрын
UnderStood bhaiya...thankYOu soo much
@Malmo308
@Malmo308 4 ай бұрын
Very nice video! Everything was explained clearly. Thank you very much!
@Ballistic_Bytes
@Ballistic_Bytes Жыл бұрын
Brilliant explanation. Loved it.
@sohammukherjee1392
@sohammukherjee1392 Жыл бұрын
24:16 that finding parent technique via backtracking was nearly similar to print shortest path using Dijkstra's algorithm where we're using that parent array
@oqant0424
@oqant0424 2 жыл бұрын
No one can teach like you!
@AlokSingh-jw8fr
@AlokSingh-jw8fr 2 жыл бұрын
Understood everything you taught in video.
@vijayarana2087
@vijayarana2087 2 жыл бұрын
Thanks for creating this video, wonderful explanation
@ddevarapaga5134
@ddevarapaga5134 2 ай бұрын
Best video for disjoint set.
@raghavmanish24
@raghavmanish24 4 ай бұрын
thanku striver for making such difficult topic so interesting
@itspurelypassionate
@itspurelypassionate Жыл бұрын
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!
@rohitn6333
@rohitn6333 2 жыл бұрын
Thanks for this wonderful explanation sir
@augustinradjou3909
@augustinradjou3909 11 ай бұрын
Astonishing work!
@paragroy5359
@paragroy5359 Жыл бұрын
Thanks a lot for making such videos it is really helpful. Great Content
@viraag8667
@viraag8667 7 ай бұрын
You made this topic look very easy thanks
@udaytewary3809
@udaytewary3809 Жыл бұрын
Understood bhaiya 🙏❤️
@shantipriya370
@shantipriya370 Жыл бұрын
just wow.. superb explanation..
@vigupta-uq1pn
@vigupta-uq1pn Жыл бұрын
goldmine for DSA🔥🔥
@vaishnavimore4860
@vaishnavimore4860 Жыл бұрын
Great explanation🚀 understood!!
@virgarg9653
@virgarg9653 Жыл бұрын
Understood Very good bro keep it up .....
@vikashkumarvlogsnitj
@vikashkumarvlogsnitj Жыл бұрын
impressed , subscribed at first video itself.
@saniyapathan8968
@saniyapathan8968 6 ай бұрын
You are the best🙌
@amitp277
@amitp277 Жыл бұрын
What a detailed explanation 👏👏
@shauryatomer1058
@shauryatomer1058 5 ай бұрын
As always great video. Thanks for the awesome content
@SachinKumar-zs6hm
@SachinKumar-zs6hm 6 ай бұрын
Understood! Thanks a lot Striver.
@sobujkhan2602
@sobujkhan2602 Жыл бұрын
this is amazing application really very nice video
@adityasood04
@adityasood04 6 ай бұрын
25:30 Keep it 1 was epic😂
@kb-ru4md
@kb-ru4md 8 ай бұрын
Best videos dp and graph🙏
@AyushEditz-hs6pf
@AyushEditz-hs6pf 4 ай бұрын
damn , you made it look so easy. Thanks Striver
@reshusingh3558
@reshusingh3558 Жыл бұрын
Understood sir ,thankyou for your support.
@Stellar_7x
@Stellar_7x 4 ай бұрын
In our university they only taught algorithms of krushkals and prims and dijkstras and in psudo code they just wrote union and gave 0 knowledge about union ...... THEY THINK THAT WE'RE THE GENIUS THAT WE FIGURE IT OUT ON OUR OWN LOL ! , aap knowledge to dete hi ho sath mai degree bhi dene lago ......
@Tbm4545
@Tbm4545 11 күн бұрын
They don't think we are genius they themselves don't know how to explain and some even dont have knowledge about that, they just come and teach u what is important for ur sem exams and done
@amanbhadani8840
@amanbhadani8840 2 жыл бұрын
Striver Bhaiya op 🥳
@achyutpal6225
@achyutpal6225 Жыл бұрын
Understood very well. Thank you 😄😄😄😄😄😄,
@nazibur175
@nazibur175 3 ай бұрын
Very good explanation!
@herculean6748
@herculean6748 Жыл бұрын
lots of love and respect🙌
@sunilpanchal1498
@sunilpanchal1498 Жыл бұрын
As always great explanation 🙂
@adebisisheriff159
@adebisisheriff159 Жыл бұрын
Amazing content as always!!!!
@az-zm4ji
@az-zm4ji 8 күн бұрын
union by size starts at 35:00
@Shubham_gupta18
@Shubham_gupta18 9 ай бұрын
best of all !! kudos to you bro
@garimagupta4208
@garimagupta4208 Ай бұрын
great video & explanation
@abhishekkuntare4640
@abhishekkuntare4640 2 жыл бұрын
Understood all the stuffs ❤❤
@gangsta_coder_12
@gangsta_coder_12 Жыл бұрын
Understood 🔥🔥
@oqant0424
@oqant0424 2 жыл бұрын
UnderStood Sir🔥🔥
@vaibhavsharmaiiitu9319
@vaibhavsharmaiiitu9319 Жыл бұрын
Amazing video loved it
@prathmeshadsod629
@prathmeshadsod629 2 жыл бұрын
So the difference between connected components and strongly connected component is in strong connected component Graph is directed and every node is reachable to another node . In connected compo. we just need somehow they are connected. Am I right ?
@shubhamraj25
@shubhamraj25 2 жыл бұрын
I guess yes till what we have studied in this lecture
@Yash-uk8ib
@Yash-uk8ib Жыл бұрын
only difference is the nature of graph and applicablity of DSU. SCC, as u mentioned will only found if graph is directed and cyclic, DSU cannot be applied here. Component is just a few nodes connected in a group. A component can be a SCC.
@ritwikamahapatra1432
@ritwikamahapatra1432 9 ай бұрын
what an explanation! THANKYOU
@devchaudhary5002
@devchaudhary5002 Жыл бұрын
Fantastic explanation! thanks a lot my man
@shubhrabrahmachari7649
@shubhrabrahmachari7649 7 ай бұрын
you inspired me today . Thank you
@rushidesai2836
@rushidesai2836 Жыл бұрын
Very well explained!
@codingid5470
@codingid5470 2 жыл бұрын
Wow such clear explanation!
@arnavumarkar8259
@arnavumarkar8259 Жыл бұрын
Very well explained. Thanks
@sanchitsrivastav453
@sanchitsrivastav453 Жыл бұрын
now I am satisfied with the logic and code
@ebukaegbunam8716
@ebukaegbunam8716 Жыл бұрын
ultimate teacher
@TanmayShimpi
@TanmayShimpi 11 күн бұрын
you have my respect buddy.
G-47. Kruskal's Algorithm - Minimum Spanning Tree - C++ and Java
13:11
take U forward
Рет қаралды 218 М.
Маусымашар-2023 / Гала-концерт / АТУ қоштасу
1:27:35
Jaidarman OFFICIAL / JCI
Рет қаралды 390 М.
5 Secrets to Stop Stuttering & Speak More Clearly!
12:44
Vinh Giang
Рет қаралды 83 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 850 М.
Disjoint set UNION by RANK and Path Compression
26:49
Techdose
Рет қаралды 52 М.
G-42. Floyd Warshall Algorithm
30:13
take U forward
Рет қаралды 247 М.
G-45. Prim's Algorithm - Minimum Spanning Tree - C++ and Java
19:10
take U forward
Рет қаралды 294 М.
Adding Way Too Many Foods to Minecraft
11:48
EightSidedSquare
Рет қаралды 190 М.
Disjoint Sets using union by rank and path compression Graph Algorithm
17:49
Tushar Roy - Coding Made Simple
Рет қаралды 317 М.
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 473 М.