Disjoint set or Union-Find is a data structure that keeps track of elements partitioned into sets. Each element starts as its own set with itself as parent. The find operation returns the root parent of an element, identifying which set it belongs to. The union operation merges two sets by linking their root parents if they are different. To keep the structure efficient, a rank array tracks tree height and helps decide which root becomes parent during union. This example shows initializing five elements, performing unions on (0,1) and (1,2), and finding the root of element 2, which is 0. The parent and rank arrays update accordingly, merging sets step-by-step.