Commit 1c886a97 authored by CDK6182CHR's avatar CDK6182CHR
Browse files

2021.5.27 update UFSet::find()

parent caed942d
......@@ -62,9 +62,9 @@ int UFSet::find(int x) const
int UFSet::find(int x)
{
int root = static_cast<const UFSet*>(this)->find(x);
while (data[x] >= 0) {
x = data[x];
while (x != root) {
data[x] = root;
x = data[x];
}
return root;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment