# Introsort Multiple choice Questions and Answers (MCQs)

## Click on any option to know the CORRECT ANSWERS

 Question 11
Why is heap sort preferred over merge sort for introsort implementation?
 A Because heap sort is faster B Because heap sort requires less space C Because heap sort is easy to implement D Because heap sort is easy to understand

Question 11 Explanation:
Both heap sort and merge sort have the same time complexity. But heap sort is an in-place sorting algorithm whereas merge sort requires O(n) auxiliary space which makes heap sort a more preferable option.

 Question 12
Why is insertion sort preferred over other sorting algorithms (like selection sort, bubble sort etc.) for introsort implementation?
 A Because insertion sort is faster and adaptive B Because insertion sort requires less space C Because insertion sort is easy to implement D Because insertion sort is easy to understand

Question 12 Explanation:
When small arrays need to be sorted then insertion sort proves to be the best choice . Also it is adaptive so it performs better than others when the given array is fully/partially sorted.

 Question 13
What is the cut-off for switching from quick sort to insertion sort in the implementation of introsort?
 A 4 B 8 C 16 D 32

Question 13 Explanation:
When small arrays needs to be sorted then insertion sort proves to be the best choice . So when the size of the partition is less than 16 introsort switches to insertion sort. This particular value has been deduced experimentally.

 Question 14
What is the cut-off for switching from quick sort to heap sort in the implementation of introsort?
 A 16 B n2 C n log(n) D 2 log (n)

Question 14 Explanation:
Quicksort has a worst case time complexity of O(n2) which is not preferable. So in order to avoid worst case of quicksort, introsort switches to heap sort when the depth is greater than 2 log(n). This particular value has been deduced experimentally.

 Question 15
Which of the following sorting algorithm will be preferred when the size of partition is between 16 and 2 log(n) while implementing introsort?
 A quick sort B insertion sort C heap sort D merge sort