added non-inplace quicksort with middle element as pivot