Quicksort with 3 way partitioning