QuickFind

sets/quickfind. QuickFind

new QuickFind(size)

Initialization.

Time complexity: O(N).
Source:
Parameters:
Name Type Description
size Numner Count of the nodes.

Methods

connected(p, q) → {Boolean}

Checks whether two nodes are connected.

Time complexity: O(1).
Source:
Parameters:
Name Type Description
p Number The first node.
q Number The second node.
Returns:
Type:
Boolean

union(p, q)

Connects two nodes - p and q.

Time complexity: O(N).
Source:
Parameters:
Name Type Description
p Number The first node.
q Number The second node.