+1 vote
in Data Structures & Algorithms II by (110k points)
Which of the following is not in place sorting algorithm by default?

(a) merge sort

(b) quick sort

(c) heap sort

(d) insertion sort

I had been asked this question during an internship interview.

Origin of the question is Sorting topic in section Sorting of Data Structures & Algorithms II

1 Answer

+1 vote
by (614k points)
selected by
Best 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.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.