Three way partition quicksort fully functional