What are the advantages and disadvantages of median-of-medians algorithm?
If you have ever used the quicksort algorithm to sort a large array of numbers, you might have noticed that its performance depends on the choice of the pivot element. If the pivot is too small or too large, the algorithm can take much longer than expected, because it creates unbalanced partitions of the array. One way to avoid this problem is to use a randomized quicksort, where the pivot is chosen randomly from the array. But is there a better way to choose the pivot that guarantees a good balance of the partitions?