Implementation of mergesort and insertiosort