Optimized union find implementation, clustering algorithms based on max-spacing objective function, prim and kruskals algorithm for minimum spanning trees.