Nielit Scientist-B CS 4-12-2016
April 5, 2025Nielit Scientist-B CS 4-12-2016
April 5, 2025Nielit Scientist-B CS 4-12-2016
Question 12 |
The running time of quick sort algorithm depends heavily on the selection of:
No. of inputs | |
Arrangement of elements in an array | |
Size of elements | |
Pivot element |
Question 12 Explanation:
The running time of Quicksort will depend on how balanced the partitions are. If you are unlucky and select the greatest or the smallest element as the pivot, then each partition will separate only one element at a time, so the running time will be similar to Insertion Sort.However, Quicksort will usually pick a pivot that is mid-range, and it will partition the array into two parts.
Correct Answer: D
Question 12 Explanation:
The running time of Quicksort will depend on how balanced the partitions are. If you are unlucky and select the greatest or the smallest element as the pivot, then each partition will separate only one element at a time, so the running time will be similar to Insertion Sort.However, Quicksort will usually pick a pivot that is mid-range, and it will partition the array into two parts.