Analysis of Kruskal with union-find [00P4]

Let's analyze this version of Kruskal's Algorithm with union-find, to discover how fast we would like the union-find operations to be!

  • Sorting edges by weight takes time \Theta (E \log V), as before.
  • We do 2E \mathsf {Find} operations, because we call it twice for each edge to check whether adding that edge would make a cycle.
  • We only call \mathsf {Union} when adding an edge, and since we are making a tree, we will do this at most V - 1 times.
Hence, the overall time, in the worst case, is \Theta (E \log V + T_{\mathsf {MakeSets}} + E T_{\mathsf {Find}} + V T_{\mathsf {Union}}). We would really like for T_{\mathsf {Find}} and T_{\mathsf {Union}} to be O(\log V), which would make the whole thing \Theta (E \log V).