Disjoint Set | UNION and FIND

  Рет қаралды 110,798

Techdose

Techdose

4 жыл бұрын

This video explains the basics of disjoint set data structure from scratch.I have explained all about disjoint set data structure in a simple and easy way to clear your basic understanding on the disjoint set data structure.I have taken intuitive examples and an intuitive algorithm to explain this data structure.I have explained the parent child relationship in a disjoint set by using tree structure for better understanding.I have explained the CODE implementation in the description below.CODE LINK is present below as usual. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)
========================================================================
INSTAGRAM : / surya.pratap.k
SUPPORT OUR WORK: / techdose
LinkedIn: / surya-pratap-kahar-47b...
WEBSITE: techdose.co.in/
TELEGRAM Channel LINK: t.me/codewithTECHDOSE
TELEGRAM Group LINK: t.me/joinchat/SRVOIxWR4sRIVv5...
=======================================================================
CODE LINK: gist.github.com/SuryaPratapK/...

Пікірлер: 266
@yooos3
@yooos3 3 жыл бұрын
Clear and concise! It's funny the moment I saw how you created the array, I understood and I was able to code it as well! This video helped me clearly visualize how Union and Find works! Thank you!
@techdose4u
@techdose4u 3 жыл бұрын
😂
@AkashPawar-qv4ps
@AkashPawar-qv4ps 2 жыл бұрын
literally this is one of the clear and conceptual explanation of union find I have ever came across.
@rummanchowdhury3807
@rummanchowdhury3807 Жыл бұрын
Fantastic explanation! It's great to hear you explain your thought process as you unfold the steps one by one
@safalyaghoshroy2405
@safalyaghoshroy2405 4 жыл бұрын
Pls don't discontinue graph series🙏🙏🙏
@sakshigupta7616
@sakshigupta7616 3 жыл бұрын
Awesome explanations! I am literally heading to your explanation for every topic I learn now and then! Keep goin'
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@smmahadibhuiyan4437
@smmahadibhuiyan4437 Жыл бұрын
this channel, this video is BEST. this topic is perfectly descrived here. None of video on this topic is not good as it in KZfaq . So RECOMMENDED for ALL.
@techdose4u
@techdose4u Жыл бұрын
Thanks for your appreciation
@naman_goyal
@naman_goyal 4 жыл бұрын
sir ur video content is very good.. in every competition i always say a time..han ye to techdose sir ki video mein dekha tha yaha yahi concept legega..thanku for this awesome concept
@techdose4u
@techdose4u 4 жыл бұрын
Thanks bro....it means a lot :)
@tranvuong3273
@tranvuong3273 6 ай бұрын
it is very helpful. I hope this channel would have more people to watch because it deserves it. thanks a lot!
@MilindGupta
@MilindGupta 2 жыл бұрын
Man you explained this so beautifully felt it's so easy now 😭🙏
@jewelchowdhury9752
@jewelchowdhury9752 Жыл бұрын
That is a great explanation of DSU..... I am deeply appreciative of your efforts and wanted to extend a heartfelt thank you.
@ashwinram9081
@ashwinram9081 4 жыл бұрын
Thanks for making this graph series. Your are always inspired to learn
@techdose4u
@techdose4u 4 жыл бұрын
Welcome :)
@adityaojha2701
@adityaojha2701 2 жыл бұрын
I am following this channel since it was having 30K subscriber. You have helped me a lot understanding DSA. Thanks a lot for such great explanations.
@techdose4u
@techdose4u 2 жыл бұрын
Great ❤️
@rajatbudania6181
@rajatbudania6181 4 жыл бұрын
Brilliant as usual :) Sir, can u plz make videos on OS or DBMS totally focusing placements!! Will be a huge help :)
@techdose4u
@techdose4u 4 жыл бұрын
I will give the important topics to study soon for theory preparation.
@MJ-ur9tc
@MJ-ur9tc 3 жыл бұрын
Superb. Very detailed explanation. Please keep up the good work. It made me subscribe to your channel. Now, I’ll definitely watch all of your videos. Thanks a ton for the excellent content.
@techdose4u
@techdose4u 3 жыл бұрын
Welcome
@shyammakwana3770
@shyammakwana3770 3 жыл бұрын
Sir again very very deeply respect to you and your all Playlist on diff topics it is very useful for us. Never stop to make videos 🙏🙏🙏🙏🙏
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@K_EC_AushoRoup
@K_EC_AushoRoup 3 жыл бұрын
Thanks!! It helped. I was struggling a lot in this topic.
@techdose4u
@techdose4u 3 жыл бұрын
Welcome
@debaratighatak2211
@debaratighatak2211 3 жыл бұрын
Thank you so much sir for giving such an amazing explanation❤️🙏
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@shaswatdas6553
@shaswatdas6553 4 жыл бұрын
a few months left before the channel explodes, cuz the content is top notch!
@techdose4u
@techdose4u 4 жыл бұрын
Thanks for appreciation :)
@shaswatdas6553
@shaswatdas6553 4 жыл бұрын
i commented on cycle detection in directed graph. Can you clear the doubt? code-gist.github.com/SuryaPratapK/e84cf8624da8a690f11d5ce31745b808 video-kzfaq.info/get/bejne/Zsp6oLemsti5ioE.html comment- Sir in this function need correction i guess... bool isCyclic_util(vector adj[], vector visited, int curr) { if(visited[curr]==true) return true; visited[curr] = true; bool FLAG = false; for(int i=0;i
@PradeepKumarIIITD
@PradeepKumarIIITD 3 жыл бұрын
I like video first, then start watching it... :)
@techdose4u
@techdose4u 3 жыл бұрын
❤️
@manojg4451
@manojg4451 3 жыл бұрын
Finally, a tutorial that makes sense 🙏🙏🙏
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@mainakmondal8691
@mainakmondal8691 3 жыл бұрын
Can't be better explanation than this one..thank you sir.
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@jigarsingh600
@jigarsingh600 4 жыл бұрын
Very well explained. Please keep making such informative videos.
@techdose4u
@techdose4u 4 жыл бұрын
Thanks
@beingvoid3246
@beingvoid3246 3 жыл бұрын
i have a doubt , at 26:06 , we have already found the absolute parent of x,y so why are we again finding the absolute parent of Fromp and Top as we already did it in the iscyclic function ?
@LUKFUNTV
@LUKFUNTV 2 жыл бұрын
Redundancy may happen sometimes.... Just ignore those 2 lines.. As we have already found the parents..
@namansharma5128
@namansharma5128 2 жыл бұрын
was finding this doubt only 😅😅
@acousticIndie
@acousticIndie 3 жыл бұрын
Thank you so much, means a lot! Keep it up!
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@iamakifislam
@iamakifislam 3 жыл бұрын
Your tutorial is the best in the internet. ❤️
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@mdimranhosen6674
@mdimranhosen6674 2 жыл бұрын
Brilliant as usual.
@aayush5474
@aayush5474 4 жыл бұрын
Best explanation bro! Thank you
@techdose4u
@techdose4u 4 жыл бұрын
Welcome :)
@jameskennedy674
@jameskennedy674 2 жыл бұрын
Pretty good Explanation.
@yulianloaiza
@yulianloaiza Жыл бұрын
You explain so well! Thank you very much :)
@techdose4u
@techdose4u Жыл бұрын
Welcome :)
@anmoljain5910
@anmoljain5910 4 жыл бұрын
seen many videos on this topic. This one explains the concept best. Please make Union by rank and Path Compression video soon.
@techdose4u
@techdose4u 4 жыл бұрын
Yes
@Faiazur_Rahman_Bhuiya_-
@Faiazur_Rahman_Bhuiya_- 3 жыл бұрын
I love this guy.
@sallaklamhayyen9876
@sallaklamhayyen9876 Ай бұрын
great explanation thank you so much🥰🥰🥰
@prajwalmp8583
@prajwalmp8583 3 жыл бұрын
This gave me a clear picture... thanks a lot😀
@techdose4u
@techdose4u 3 жыл бұрын
Welcome
@PoojaGupta-ry3oj
@PoojaGupta-ry3oj 4 жыл бұрын
can you also make video on backtracking..till now I haven't found any good resource for it. ur videos are so good.. it gives grasp on the concept in one go..
@techdose4u
@techdose4u 4 жыл бұрын
I will start that series later along with dynamic programming.
@PoojaGupta-ry3oj
@PoojaGupta-ry3oj 4 жыл бұрын
@@techdose4u thank u.. wish to see soon :)
@sarthakbhatia7888
@sarthakbhatia7888 3 жыл бұрын
Thankyou..:)...This series is great
@techdose4u
@techdose4u 3 жыл бұрын
Thanks
@ss-xh3hf
@ss-xh3hf 3 жыл бұрын
Loving it please make a similar series on backtracking
@techdose4u
@techdose4u 3 жыл бұрын
It will come. Stay tuned :)
@amrkhalid275
@amrkhalid275 7 ай бұрын
thank u sir very helpful ...
@shubhamkhurana7545
@shubhamkhurana7545 4 жыл бұрын
That was really something new!!
@techdose4u
@techdose4u 4 жыл бұрын
:)
@deepakprajapati5064
@deepakprajapati5064 3 жыл бұрын
Explaining complex problem in a simple way 🔥🔥
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@shagunlamba6481
@shagunlamba6481 3 жыл бұрын
amazing explaination, thank you :)
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@nikitamandlik6067
@nikitamandlik6067 2 жыл бұрын
Thanks for the explanation :) May I know which tool is used for explaining the problems
@princeakhil208
@princeakhil208 4 жыл бұрын
Tech dose is back 😁 maza aa gaya
@techdose4u
@techdose4u 4 жыл бұрын
Yep :D
@sudhanshukumar1558
@sudhanshukumar1558 4 жыл бұрын
I got my binge watching content. Thanks 😊
@techdose4u
@techdose4u 4 жыл бұрын
Awesome :D
@sudhanshukumar1558
@sudhanshukumar1558 4 жыл бұрын
@@techdose4u done with watching it, great explanation 👍
@techdose4u
@techdose4u 4 жыл бұрын
Thanks
@impatientgaming9868
@impatientgaming9868 6 ай бұрын
Really Helpful!
@vishaltk3013
@vishaltk3013 3 жыл бұрын
which software are you using to draw and demo using the slides?
@kavishamanchanda7141
@kavishamanchanda7141 3 жыл бұрын
Can you please tell me in the union function why did you add absolute parents in the dfus array and why not the original fromP and toP
@divyanshdixit4944
@divyanshdixit4944 4 жыл бұрын
Thanks for the amazing video. Please add Linux video that you promised, whenever you get time. Once again keep up the good work.
@techdose4u
@techdose4u 4 жыл бұрын
Linux video for theory syllabus?
@divyanshdixit4944
@divyanshdixit4944 4 жыл бұрын
@@techdose4u Yes sir, list of important topics and commands of Linux for interview
@kunalsoni7681
@kunalsoni7681 4 жыл бұрын
Very helpful video 😊😇.. Thank you sir
@techdose4u
@techdose4u 4 жыл бұрын
Welcome :)
@uditghosh3247
@uditghosh3247 4 жыл бұрын
This is pure gold.
@techdose4u
@techdose4u 4 жыл бұрын
Thanks
@jayantaghosh7678
@jayantaghosh7678 3 ай бұрын
awesome explanation
@bhuvanchandrajoshi9138
@bhuvanchandrajoshi9138 3 жыл бұрын
I think you are underrated like imdb movies
@techdose4u
@techdose4u 3 жыл бұрын
Hope I get good reach soon :)
@Leetforces_com
@Leetforces_com 4 жыл бұрын
Wow!! too easy explanation ❤️
@techdose4u
@techdose4u 4 жыл бұрын
Thanks
@abhishekkeer1520
@abhishekkeer1520 4 жыл бұрын
what is need of again call find function in union_op because we already get absolute root of both element ?
@shushantgaur9420
@shushantgaur9420 3 жыл бұрын
Exactly... Line 15 and 16 are doing same thing as line 24 25, right?
@techdose4u
@techdose4u 3 жыл бұрын
You can skip that. I have commented it in the next video.
@shushantgaur9420
@shushantgaur9420 3 жыл бұрын
@@techdose4u yes I saw that afterwards but I forgot to remove this comment😅. By the way that's one hell of an explaination..... I don't think I'm gonna forget it anytime soon.... Thanks 😊.
@techdose4u
@techdose4u 3 жыл бұрын
@@shushantgaur9420 You better not forget it :P
@shushantgaur9420
@shushantgaur9420 3 жыл бұрын
@@techdose4u never😁
@joydeepbhattacharjee5305
@joydeepbhattacharjee5305 3 жыл бұрын
great video...best channel for DSA
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@ridoychandradey8337
@ridoychandradey8337 2 жыл бұрын
Thank you very much.
@frunked
@frunked 3 жыл бұрын
helped me on my exam. much love from university of illinois 👍
@techdose4u
@techdose4u 3 жыл бұрын
Thanks Matt ❤️
@lancelotdsouza4705
@lancelotdsouza4705 2 жыл бұрын
beautifully explained
@shanmukhavarma3361
@shanmukhavarma3361 4 жыл бұрын
Tq bro I could solve dsu problems in codeforces
@techdose4u
@techdose4u 4 жыл бұрын
Nice :) this was just basic. I will soon make optimized dsu as well :)
@musheer.ahmed.0
@musheer.ahmed.0 2 жыл бұрын
Thanks you very much😁
@bespoyasov
@bespoyasov 2 жыл бұрын
Awesome! Thank you!
@techdose4u
@techdose4u 2 жыл бұрын
Welcome 😊
@prabhatchanchal
@prabhatchanchal 4 жыл бұрын
Thanks sir. please make all of DSU lecture in series from now. like kruskal and DSU on grid.
@techdose4u
@techdose4u 4 жыл бұрын
I will give optimized approach explanations and later I will add more complex algos. Fir now, target is to cover for interview.
@frankdaniel3506
@frankdaniel3506 2 жыл бұрын
Which Software are you using for explanation?Thanks-Frank
@rudreshajgaonkar
@rudreshajgaonkar 2 жыл бұрын
If the nodes are 0,1,2,3 then using a Array is fine to keep track of parent child relationship. But the moment we have vertices as 3,4,5,6 isnt it good to keep a map in that place?
@mahipalsingh-yo4jt
@mahipalsingh-yo4jt 3 жыл бұрын
great explanation sir !!!!!!!!!!!!!!!!!!!!
@techdose4u
@techdose4u 3 жыл бұрын
Thanks
@siddharthasharma9316
@siddharthasharma9316 4 жыл бұрын
Going to watch this tonight.....pakka
@techdose4u
@techdose4u 4 жыл бұрын
Nice
@yasharma2301
@yasharma2301 3 жыл бұрын
Perfect explanation!
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@khaledov7305
@khaledov7305 2 ай бұрын
Thanks a lot .
@shreelakshmi6890
@shreelakshmi6890 3 жыл бұрын
Great video again!!👌
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@AltafHussain-on2oe
@AltafHussain-on2oe 3 жыл бұрын
Thanks from the Heart 💖
@techdose4u
@techdose4u 3 жыл бұрын
Welcome 😊
@rishijha9860
@rishijha9860 4 жыл бұрын
Very well explained!!!
@techdose4u
@techdose4u 4 жыл бұрын
Thanks :)
@VarunKaushal-zx9zq
@VarunKaushal-zx9zq Жыл бұрын
Amazing sir
@kumartejaswi712
@kumartejaswi712 3 жыл бұрын
bhai yaar😍
@dovyraj1272
@dovyraj1272 3 жыл бұрын
can v use graph coloring and dfs for representing same set, that would b every easy
@techdose4u
@techdose4u 3 жыл бұрын
Disjoint set will be easier and much more efficient. Try to learn disjoint set and you will know the simplicity of this DS.
@karthikeyank7467
@karthikeyank7467 Жыл бұрын
Thank you buddy
@yihongliu3850
@yihongliu3850 3 жыл бұрын
very nice content as usual sir! just have one small question -- at line 24& line 25, we already find the absolute parent of the subset.. and in the union_op function (line 13-18) we find that again.. is it because we want to keep the complete functionality of union_op here?
@techdose4u
@techdose4u 3 жыл бұрын
I think you can skip that. I may have forgot to not comment those lines
@yihongliu3850
@yihongliu3850 3 жыл бұрын
@@techdose4u haha thanks!!
@dochimekashiariri7610
@dochimekashiariri7610 2 жыл бұрын
in the union function, there is no need to write the find function right?? cause we are already sending the absolute parent to it.
@SUJOYPAULJOBS
@SUJOYPAULJOBS 3 жыл бұрын
khub bhalo bojalen sir nice teacher
@techdose4u
@techdose4u 3 жыл бұрын
Dhonnobaad :)
@nehamahendrasingh4478
@nehamahendrasingh4478 4 жыл бұрын
Hi :)Thank you so much for the video .. Could you please make a video on time and space complexity .Thank you
@techdose4u
@techdose4u 4 жыл бұрын
Do you mean time and space complexity series videos?
@nehamahendrasingh4478
@nehamahendrasingh4478 4 жыл бұрын
TECH DOSE yes please, Atleast one video explaining how to calculate time and space complexity
@Mandeepsingh-jo5cf
@Mandeepsingh-jo5cf 3 жыл бұрын
Thanks graph specialist.
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@rajmani4486
@rajmani4486 3 жыл бұрын
amazing explanation...
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@ayushgoel9584
@ayushgoel9584 4 жыл бұрын
Hi bro, I checked your content , it is awesome, but it would be great if you can arrange all your videos in difficulty level and topic wise level in your playlist.Many videos are missing in playlist or repeating in playlist. Please try to create proper sequence of all your videos, so that it would be helpful for everyone
@techdose4u
@techdose4u 4 жыл бұрын
Thanks. I am trying to do that
@ayushgoel9584
@ayushgoel9584 4 жыл бұрын
@@techdose4u yeah, I have recommended your channel to many of my friends, some of them are begineers, and they get lost from where to start watching your videos, thats why
@techdose4u
@techdose4u 4 жыл бұрын
Okay....I understand. I will arrange them. Actually I haven't covered many basic topics like time and space complexity, hash, heap etc properly. There are missing topics as well. So, as soon as I finish graph algorithms, I will cover the basics and clear them so that I will have everything required for placement purpose :)
@Aman-jc7pu
@Aman-jc7pu 2 жыл бұрын
I think there is no need to again find the absolute parent in union function. By the way Great Explanation.
@nishithramanuj509
@nishithramanuj509 2 жыл бұрын
Very good explanation sir
@techdose4u
@techdose4u 2 жыл бұрын
Thanks 😊
@pavanbhalkey4309
@pavanbhalkey4309 3 жыл бұрын
can you please explain the point "Union operation has no directionality" ?
@dharmeshupadhyay4778
@dharmeshupadhyay4778 3 жыл бұрын
sir i love your videos , you are an excellent teacher , and sir your voice is fabulous sir plz also make MOTIVETIONAL VIDEOS ,i will be first to watch it sir i thing in union() operation their is no need to call find() bcz we already have parents ,?????????????????????
@techdose4u
@techdose4u 3 жыл бұрын
Try it out. Maybe it's true :)
@pulkitmoolchandani6049
@pulkitmoolchandani6049 4 жыл бұрын
great video :)
@techdose4u
@techdose4u 4 жыл бұрын
Thanks :)
@acxd
@acxd 3 жыл бұрын
Amazing amazing !!
@techdose4u
@techdose4u 3 жыл бұрын
Thanks thanks :D
@mathewsjose1990
@mathewsjose1990 28 күн бұрын
Nice explanation!
@techdose4u
@techdose4u 25 күн бұрын
thanks
@shalini-j-2r
@shalini-j-2r 3 жыл бұрын
I do not think , we need to use find again in union method as we have already find the parent of both elements. Is there any specific reason?
@techdose4u
@techdose4u 3 жыл бұрын
No specific reason. Try to exclude it. I had exluded it in my next lecture.
@himanshuchhikara4918
@himanshuchhikara4918 4 жыл бұрын
Welcome back sir
@techdose4u
@techdose4u 4 жыл бұрын
Thanks :)
@VarsneyaSrinivas
@VarsneyaSrinivas 3 жыл бұрын
Pls don't ever stop.
@techdose4u
@techdose4u 3 жыл бұрын
Sure :)
@psthakur1199
@psthakur1199 4 жыл бұрын
Please could you upload a few more good Backtracking Problems in Recursion playlist.
@kumarsaurabh2025
@kumarsaurabh2025 4 жыл бұрын
NOPES!
@sagarlandge3271
@sagarlandge3271 3 жыл бұрын
Best 26.42 minutes of my life
@anantpawar782
@anantpawar782 2 жыл бұрын
why u find absolute parent again in union_op function. We already find out abs parent in isCylic func.
@amitavamozumder73
@amitavamozumder73 3 жыл бұрын
end cycle detection was basically Kruskal's algorithm!
@emilybao
@emilybao 2 жыл бұрын
Thank you!
@techdose4u
@techdose4u 2 жыл бұрын
Welcome 😊
@david.breyer
@david.breyer 2 жыл бұрын
Sir, why does 17:35 connect 0 to 3 in the image but the array is 1 to 3 ? It should be like: 0 -- 1 / | 3 -- 2
@niteshkhetan9757
@niteshkhetan9757 3 жыл бұрын
Sir in the first tree which looks like linked list, why is 2 the parent of 3, instead 3 is the parent of 2... Right? Am I missing something?
@ravikumarkamble6403
@ravikumarkamble6403 3 жыл бұрын
hey Tech dose your video are amazing can u plz provide these ppt type explanation screenshots it will more helpful for the revision after seeing the video.
@techdose4u
@techdose4u 3 жыл бұрын
Thanks. I am putting them on our website.
@ravikumarkamble6403
@ravikumarkamble6403 3 жыл бұрын
@@techdose4u nice to see.
@Sky-nt1hy
@Sky-nt1hy 3 жыл бұрын
Hi !! I have a question regarding the code. Aren't line 15,16 unnecessary? Since when you pass fromP and toP to union_op function, they're already the absolute roots so it seems there's no need to find the absolute roots when they are already. Thank you!
@techdose4u
@techdose4u 3 жыл бұрын
Yea seems so. You can comment that.
@Sky-nt1hy
@Sky-nt1hy 3 жыл бұрын
@@techdose4u That was almost an instantaneous reply. Thank you!
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
Disjoint set UNION by RANK and Path Compression
26:48
Techdose
Рет қаралды 50 М.
Understanding B-Trees: The Data Structure Behind Modern Databases
12:39
Nastya and SeanDoesMagic
00:16
Nastya
Рет қаралды 30 МЛН
Дарю Самокат Скейтеру !
00:42
Vlad Samokatchik
Рет қаралды 8 МЛН
Union Find in 5 minutes - Data Structures & Algorithms
5:46
Potato Coders
Рет қаралды 197 М.
The hidden beauty of the A* algorithm
19:22
polylog
Рет қаралды 848 М.
Disjoint Sets using union by rank and path compression Graph Algorithm
17:49
Tushar Roy - Coding Made Simple
Рет қаралды 311 М.
Kosaraju Algorithm | Strongly connected components in a graph
24:30
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 628 М.
Prims algorithm | MST | Code implementation
30:55
Techdose
Рет қаралды 137 М.
Minimum edit distance | Dynamic programming | Backtracking
28:52
Kruskals algorithm | Construct MST
9:28
Techdose
Рет қаралды 40 М.
Nastya and SeanDoesMagic
00:16
Nastya
Рет қаралды 30 МЛН