ST based implementation of Tarjan's disjoint set forests, using mutable
arrays storing indices instead of references internally. There is also
a pure, immutable version of the data structure, which is useful for
querying the result of a union find construction.