1.

Which of the following is not in place sorting algorithm by default?(a) merge sort(b) quick sort(c) heap sort(d) insertion sortI had been asked this question during an internship interview.Origin of the question is Sorting topic in section Sorting of Data Structures & Algorithms II

Answer»

Correct choice is (a) merge sort

The best I can EXPLAIN: Quick sort, HEAP sort, and INSERTION sort are in-place sorting ALGORITHMS, whereas an additional space of O(n) is required in order to merge two SORTED arrays. Even though we have a variation of merge sort (to do in-place sorting), it is not the default option. So, among the given choices, merge sort is the most appropriate answer.



Discussion

No Comment Found

Related InterviewSolutions