From c2de3b2c50126bb4d9fa6f916ba6803e4aff35e5 Mon Sep 17 00:00:00 2001 From: Jet Hughes Date: Sat, 11 Jun 2022 11:52:24 +1200 Subject: [PATCH] vault backup: 2022-06-11 11:52:24 --- content/notes/union-find.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content/notes/union-find.md b/content/notes/union-find.md index 89f2ac338..2e6a27cef 100644 --- a/content/notes/union-find.md +++ b/content/notes/union-find.md @@ -161,6 +161,8 @@ If could happen that the sequence of Union operations does not create a rank tha ### 3.4 UF 4 Change find so it implements path compression to "flatten" the chains. When we follow tht path to a nodes representative we "learn" the final result +path compression occurs during find when we the chain of links from an element to its representative with a direct link (and do the same along the chain) + ```java if (x != reps[x]) { reps[x] = find(reps[x]);