For the disjoint sets explore card I don't understand how the "optimized" disjoint set with both path compression and union by rank is "accurate". When doing path compression you end up changing the height/rank with find, but the rank is never decremented. Couldn't this lead to cases where the disjoint set with the shorter height actually ends up being the one chosen. Is that why its the ackerman function, because worst case it is linear on the first call, but then constant afterwards? I guess it's okay to have the incorrect rank, since its faster to keep track of the "potentially" worse one, rather than spending linear time confirming the height/rank after each find?
Find Union
Quick Find 1 N
Quick Union N N
Union by Rank logn logn
Path Compress logn logn
Rank & Compress A(N) A(N)Quick find has a very straightforward time complexity. I see how the worst case in quick union can be linear for find and union and could maintain worst case repeatedly. Once you add the union by rank, it takes more space, but then should never get worse than logN. Path compression is where i start to get a little confused. Every union calls find and find has path compression, but worst case could result int always unioning roots, which can allow for linear worst case, right? So wouldn't path compression alone be linear worst case (but if repeated constant on repetitions? So that results in log avg?) When combining the two how is the answer A(N) due to union by rank isnt worst case logN? and then with path compression isnt it just improving upon logN to be if repeated constant? What am i misunderstanding?