ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
mfset Directory Reference

Files

 
ListMFSet.h
 The MFSET on lists of section 10.2.1 [see MFSet.h], each element knowing the head of its list: find() in \( O( 1 ) \), merge() relabels the shorter list, so that an element is relabeled at most \( \log_2 n \) times.
 
MFSet.h
 The MFSET of section 10.2, the union of disjoint sets: MFSet( n ) makes the \( n \) components \( \{ 0 \} , \ldots , \{ n - 1 \} \), find( x ) gives the representative of the component of \( x \), and merge( x , y ) joins the components of \( x \) and \( y \), if they are distinct.
 
RemUnionFind.h
 The engineered MFSET, beyond the book [see MFSet.h for the forest of section 10.2 with the union by rank and the compression of the paths]: the union of disjoint sets by the algorithm of Rem with splicing, which the experiments of Patwary, Blair and Manne found the fastest of the sequential algorithms of union and find.
 
RollbackUnionFind.h
 The MFSET of section 10.2 with the undo of its merges, beyond the book [see MFSet.h], and on it the connectivity of a graph whose edges come and go, when all the changes and the questions are known in advance (see Undo of the merges and offline connectivity).
 
UnionFind.h
 The MFSET of section 10.2 engineered, beyond the book [see MFSet.h]: the forest of the parents in one vector of integers, where a root keeps minus the size of its tree instead of a parent, so that the union by size needs no second vector and a find() touches one array; find() halves the path (every other node on the way is made a child of its grandparent), which needs a single pass, no recursion and no stack, and keeps the bound of the compression with the union by size (Tarjan and van Leeuwen): a sequence of \( m \geq n \) operations on \( n \) elements takes.