Quick Find - Eager Approach

Quick Find - Eager Approach

Data structure : Integer Array id[]of length N

Interpretation:

Find: p and q are connected iff they have the same id.

Union: To merge components containing p and q, change all entries whose id equals id[p] to id[q]

Quick Find - Eager Approach

After union(6,1)

Java Implementation

Last updated

Was this helpful?