Mergesort and Kruskal Algorithms