3-way partition
selection using 3-way partition