Find pivot using Scala's quicksort method.