Calculate operations for pivot around the median of the 1st last and middle elements of the array