python mergesort and quicksort algorithm implementation