Quicksort which is optimized for special cases.