Code for disjoint set. Applied both union by rank and path
compression.
Code for Kruskal's algorith on MST.