generic version quicksort