Disjoint-set data structure: Difference between revisions

Content deleted Content added
AmirOnWiki (talk | contribs)
Other structures: backtracking
AmirOnWiki (talk | contribs)
Operations: union with user-defined representative
Line 187:
 
It is clear from the above implementations that the size and rank of a node do not matter unless a node is the root of a tree. Once a node becomes a child, its size and rank are never accessed again.
 
There is a variant of the <code>Union</code> operation in which the user determines the representative of the formed set. It is not hard to add this functionality to the above algorithms without losing efficiency.
 
== Time complexity ==