Implement quicksort and mergesort