1.

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 understandThis question was posed to me in an online interview.This key question is from Sorting in section Sorting of Data Structures & Algorithms II

Answer»

Right answer is (a) Because insertion SORT is faster and adaptive

BEST 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.



Discussion

No Comment Found

Related InterviewSolutions