Quick Sort Experiment
1. Quick Sort is generally considered to be:
2. Given a random policy for choosing the pivot, when can Quick Sort encounter its worst-case time complexity?
3. Consider the following Quick Sort pseudo-code. Which pair can be selected for blanks (A) and (B) simultaneously so that values smaller than the pivot go to smaller_array and values greater than or equal to the pivot go to bigger_array?
quick_sort(array) -> sorted-array:
if array is empty: return array
pivot = choose_pivot_index()
smaller_array = [], bigger_array = []
for i = 1 to sizeof(array):
if (-----A-----):
append array[i] to smaller_array
else if (-----B-----):
append array[i] to bigger_array
return quick_sort(smaller_array) + [array[pivot]] + quick_sort(bigger_array)
4. What is the average-case time complexity of Quick Sort when pivot selection produces reasonably balanced partitions?
5. What is the worst-case time complexity of Quick Sort when every partition places only one element on one side of the pivot and all remaining elements on the other side?
6. Which statement best describes the auxiliary space complexity of recursive Quick Sort?
7. Which property of Quick Sort is most directly responsible for its average-case time complexity of ?
8. If the pivot divides an array of size into two subarrays of approximately equal size, which recurrence best represents the running time of Quick Sort for that partition pattern?
9. Which comparison of sorting algorithms is correct for their typical time complexities?