-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
unionFind class method find has extra step. It does compression even if it is not needed.
while (p != root) { int next = id[p]; id[p] = root; p = next; }
can be modified to the following to bypass unnecessary step
while (id[p] != root) { int next = id[p]; id[p] = root; p = next; }
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels