+1 vote
in Data Structures & Algorithms II by (110k points)
What is the auxiliary space complexity of standard merge sort?

(a) O(1)

(b) O(log n)

(c) O(n)

(d) O(n log n)

This question was posed to me during a job interview.

My query is from Sorting in chapter Sorting of Data Structures & Algorithms II

1 Answer

+1 vote
by (614k points)
selected by
 
Best answer
Correct answer is (c) O(n)

Easiest explanation - The merging of two sorted arrays requires an additional space of n due to which the auxiliary space requirement of merge sort is O(n). Thus merge sort is not an in place sorting algorithm.

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.

Categories

...