implementing linear quicksort