export declare class DisjointSet { private _parentMap; private _rankMap; /** * Adds a new node to the disjoint set. * * @param node The node to add. * * @timeComplexity `O(1)` * * @returns Returns false if the node is already in the disjoint set. */ add(node: T): boolean; /** * Finds the root of the set containing the given node. * * @param node The node to find. * * @timeComplexity `O(α(n))` where `α(n)` is the inverse Ackermann function * * @returns The representative node of the set, or null if the node * is not found. */ find(node: T): T | void; /** * Finds the root of the set containing the given node. * It adds the node to the set if it does not exist. * * @param node The node to find or add. * * @timeComplexity `O(α(n))` where `α(n)` is the inverse Ackermann function * * @returns The representative node of the set. */ findOrAdd(node: T): T; /** * Unites the sets containing the 2 given nodes. * * @param nodeA The first node. * @param nodeB The second node. * * @timeComplexity `O(α(n))` where `α(n)` is the inverse Ackermann function * of `n`. * * @returns Returns false if the 2 nodes are already in the same set. */ union(nodeA: T, nodeB: T): boolean; /** * Clears the disjoint set. * * @timeComplexity `O(1)` */ clear(): void; /** * Returns the number of elements in the disjoint set. * * @timeComplexity `O(1)` */ size(): number; }