Question: 1) Here is an array which has just been partitioned by the first step of quicksort: 3, 4, 0, 2, 5, 8, 6, 10, 7,
1) Here is an array which has just been partitioned by the first step of quicksort: 3, 4, 0, 2, 5, 8, 6, 10, 7, 9 Which of these elements could be the pivot?
a. 3 b. 4 c. 5 d. 9 e. b and c
2) Suppose were debugging a quicksort implementation that is supposed to sort an array in ascending order. After the first partition step has been completed, the contents of the array are in the following order: 3 9 1 14 17 24 22 20 Which of the following statements is correct about the partition step? a. The pivot could have been either 14 or 17. b. The pivot could have been 14, but could not have been 17. c. The pivot could have been 17, but could not have been 14. d. Neither 14 nor 17 could have been the pivot.
Please explain to me how to solve these problems step by step.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
