Question: Consider the following implementation of Randomized Quick sort RANDOMIZED-PARTITIONCA, P.) 11. RANDOM, exchange Alrl with Al 3 return PARTITIONCA, P. RANDOMIZED-QUICKSORT(A. p.) f per 2
Consider the following implementation of Randomized Quick sort RANDOMIZED-PARTITIONCA, P.) 11. RANDOM, exchange Alrl with Al 3 return PARTITIONCA, P. RANDOMIZED-QUICKSORT(A. p.) f per 2 q=RANDOMIZED-PARTITIONA, P.) 3 RANDOMIZED-QUICKSORTA. p. q-1) 4 RANDOMIZED-QUICKSORTIA. 2.0) In an array with 100 elements, what is the expected number of comparisons if RANDOMIZED-QUICKSORT is done to sort the elements? Select one: a 100(99) 99 100- b. 2 k + 1 c. 100 + 100 O d. 2(100) (log 100) O cannot be determined Assume that an array has 5 elements, what is the probability that the worst case scenario for RANDOMIZED - QUICKSORT occurs? Select one: O a. 1/120 b. 1/2 C. 1/100 d. 1/25 e. 1/5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
