3.1 Wisely chosen pivot

If the pivot is chosen wisely, then each partition divides an array into two halves (or approximately two halves). The time complexity of the partition algorithm is proportional to the number of elements in the array segment to consider. Given an optimal pivot is chosen for each partition, then it will take at most log 2(n)levels of recursion to sort an array of n items.

At each level, the total number of elements to be considered is n.

As a result, the time complexity of the algorithm is O(nlog(n)). However, this assumes that wisely choosing a pivot does not incur extra time penalty.