4. Suppose that various variants of QUICKSORT are given as input an array with all the elements having the same value. (a) What is the running time of the version of QUICKSORT that chooses the pivot as the first element of the array on this array? Justify your answer. (b) What is the running time of a randomized QUICKSORT on this array? Justify your answer. A randomized QUICKSORT chooses the pivot randomly from the array indices. (c) What is the running time of the version of QUICKSORT that uses MOMSELECT to choose the pivot on this array? Justify your answer.

icon
Related questions
Question

question 4

4. Suppose that various variants of QUICKSORT are given as input an array with all the elements
having the same value.
(a) What is the running time of the version of QUICKSORT that chooses the pivot as the first
element of the array on this array? Justify your answer.
(b) What is the running time of a randomized QUICKSORT on this array? Justify your answer.
A randomized QUICKSORT chooses the pivot randomly from the array indices.
(c) What is the running time of the version of QUICKSORT that uses MOMSELECT to choose
the pivot on this array? Justify your answer.
Transcribed Image Text:4. Suppose that various variants of QUICKSORT are given as input an array with all the elements having the same value. (a) What is the running time of the version of QUICKSORT that chooses the pivot as the first element of the array on this array? Justify your answer. (b) What is the running time of a randomized QUICKSORT on this array? Justify your answer. A randomized QUICKSORT chooses the pivot randomly from the array indices. (c) What is the running time of the version of QUICKSORT that uses MOMSELECT to choose the pivot on this array? Justify your answer.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer