Class: QuickUnion

sets/weightquickunion. QuickUnion

Constructor

new QuickUnion(size)

Initialization.

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

Methods

connected(p, q) → {Boolean}

Checks whether two nodes are connected.

Time complexity: O(log N).
Parameters:
Name Type Description
p Number The first node.
q Number The second node.
Source:
Returns:
True/false depending on whether the nodes are connected.
Type
Boolean

union(p, q)

Connects two nodes - p and q.

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