Quicksort using a 3-way partition