Try to mimic the partition method used in the in-place quick-sort algorithm.