![]() |
VOOZH | about |
The term DSU stands for Disjoint Set Union, in the context of Computer Science.
A data structure that stores non overlapping or disjoint subset of elements is called disjoint set data structure.
Two sets are called disjoint sets if they don't have any element in common, the intersection of sets is a null set.
Disjoint Set Data Structures are often called Disjoint Set Union or DSU because of their two main operations:
It means that if we are given several elements, each of which is a separate set, a Disjoint Set Data Structure will have an operation to combine any two sets (UNION), and it will be able to tell in which set a specific element is (DISJOINT SET).
As a combination of the above operations, Disjoint Set Data Structures are also called as Disjoint Set Union or DSU.
Thus the basic implementation of the DSU data structure consists of only three operations:
The main advantage of using DSU is that it allows the above operations in constant time, i.e. O(1) on average.