Returns the representative element of the disjoint set that element value is part of. If the given element is not part of any set, then undefined is returned. The method uses the path compression heuristic which mutates the parent pointer of each element, part of the find path, by making it point directly to the set representative.
Also, the corresponding TypeScript ambient declarations are included in the PR.
Description
The PR introduces the following new unary method:
DisjointSet#findSet(value)
Returns the representative element of the disjoint set that element
value
is part of. If the given element is not part of any set, thenundefined
is returned. The method uses the path compression heuristic which mutates the parent pointer of each element, part of the find path, by making it point directly to the set representative.Also, the corresponding TypeScript ambient declarations are included in the PR.