Disjoint Set Union By Rank and Path Compression - | DSU | Graph Concepts & Qns -19| Explanation+Code

Subscribers:
92,300
Published on ● Video Link: https://www.youtube.com/watch?v=iH3XVIVzl7M



Duration: 22:09
691 views
50


Hi Everyone, this is the 19th video of our Playlist "Graph Concepts & Qns".
In video-18, we understood a very important topic in Graph "Disjoint Set Union (DSU)"
In this video we will see the optimized version of DSU using Rank and Path Compression.


Problem Name : Disjoint Set Union By Rank and Path Compression
Topic : Graph
Video : 19
Company Tags : Google, Facebook, Apple, Amazon, Netflix, Flipkart


My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Interview_DS_Algo
Subscribe to my channel : https://www.youtube.com/@codestorywithMIK

0:00 - Intro & Recap
1:20 - Understanding Path Compression from Example
8:12 - find() using Path Compression
10:04 - Understanding Rank from Example
12:55 - Why Larger Rank is chosen as Parent
17:04 - union() using Rank

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝

#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview #interviewtips
#interviewpreparation #interview_ds_algo #hinglish




Other Videos By codestorywithMIK


2023-01-22Detect Cycle using DSU - (Google, Microsoft) | Graph Concepts & Qns - 20 | Explanation+Coding
2023-01-22Palindrome Partitioning - (Google, Microsoft, Meta) (Khaandani Template) : Explanation ➕ Live Coding
2023-01-21Restore IP Addresses - (META) : Explanation ➕ Live Coding
2023-01-20Non-decreasing Subsequences -(Khaandani Backtracking Template) : Explanation ➕ Live Coding
2023-01-19Subarray Sums Divisible by K - (Microsoft, Amazon, Paytm) : Explanation ➕ Live Coding
2023-01-17Maximum Sum Circular Subarray (Microsoft, Amazon) : Explanation ➕ Live Coding
2023-01-17Flip String to Monotone Increasing - (GOOGLE) | Optimal | Explanation ➕ Live Coding
2023-01-17Flip String to Monotone Increasing - (GOOGLE) | Recursion+Memo | Explanation ➕ Live Coding
2023-01-16Insert Interval (Google, Twitter, Microsoft, Apple, Amazon) : Explanation ➕ Live Coding
2023-01-15Number of Good Paths | GOOGLE | DSU | Explanation ➕ Live Coding
2023-01-15Disjoint Set Union By Rank and Path Compression - | DSU | Graph Concepts & Qns -19| Explanation+Code
2023-01-15Disjoint Set Union - | DSU | Graph Concepts & Qns - 18 | Explanation+Coding
2023-01-15Is Graph Bipartite ? - (Facebook, Microsoft) | BFS | Graph Concepts & Qns - 17 | Explanation+Coding
2023-01-14Is Graph Bipartite ? - (Meta, Microsoft..) | DFS | Graph Concepts & Qns - 16 | Explanation+Coding
2023-01-14Lexicographically Smallest Equivalent String | DFS | Explanation ➕ Live Coding
2023-01-12Longest Path With Different Adjacent Characters : (Microsoft) | Explanation ➕ Live Coding
2023-01-12Number of Nodes in the Sub-Tree With the Same Label : (Better Approach) | Explanation ➕ Live Coding
2023-01-12Number of Nodes in the Sub-Tree With the Same Label : Explanation ➕ Live Coding
2023-01-11Course Schedule-II - (Apple,Microsoft,Amazon) | DFS | Graph Concepts & Qns - 15 | Explanation+Coding
2023-01-10Minimum Time to Collect All Apples in a Tree - (Microsoft) : Explanation ➕ Live Coding
2023-01-10Course Schedule - (Apple, Microsoft,Amazon) | DFS | Graph Concepts & Qns - 14 | Explanation+Coding