We got through most of Union-Find today. The idea is to represent disjoint sets as trees, with a canonical element, i.e. the representative of that set, as the root. The important heuristics for union and find are union-by-rank and path compression, respectively.

Union-by-rank always makes the smaller tree a subtree of the larger one.

Path compression is based on the principle that if we’ve done some work, say O(lg n), then we shouldn’t have any problem with doing it again, since that’s still O(lg n). In that case, when we do a find, it might take a long time to find the root of the tree, but then we go back and change all the parent pointers in the path to the root of the tree. That way, any future finds are shorter.

We wrapped up with a couple exercises that help explain why the complexity of Union-Find isn’t exactly linear. Make sure to think about these since we’re probably going to talk about them later in the week.

Don’t forget that HW3 is due next lecture at the start of class.

Next time, Professor Steven Rudich will lecture on the 3SUM problem. ** Please make sure to read the chapter on the Fast Fourier Transform (FFT) in Kozen before the next lecture.**

### Like this:

Like Loading...

*Related*