Quick sort implementation which can handle duplicates well.
Algorithm
In 3 Way QuickSort, an array arr[l..r] is divided in 3 parts:
* arr[l..i] elements less than pivot.
* arr[i+1..j-1] elements equal to pivot.
* arr[j..r] elements greater than pivot