Here is the question: enter image description here
I understand that the absolute parents are 1, 3, 0, and 8, respectively, but I'm not sure how to do union here. Could someone help me understand how to do this?
-
$\begingroup$ Just blindly follow the procedures given for the $Union$ and $Find$ operations. $\endgroup$codeR– codeR2024年04月27日 13:14:03 +00:00Commented Apr 27, 2024 at 13:14
-
$\begingroup$ Please don't use images of text or mathematics. This makes your question impossible to search and inaccessible to the visually impaired; we don't like that. Please transcribe text and mathematics. You can use LaTeX. Also, we require you to provide attribution for the source where you are obtaining this problem/material from. $\endgroup$D.W.– D.W. ♦2024年04月28日 04:19:13 +00:00Commented Apr 28, 2024 at 4:19
1 Answer 1
To take the first question, (i).
When you want to perform union(8, 9) you do r1 = find(8) and r2 = find(9), and then you let either r1 point to r2 or vice versa.
In this case, they have the same rank, and as it says, you should break even by spring by index, hence 8 should point to 0.
Explore related questions
See similar questions with these tags.