+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)

The question was posed to me during an online exam.

Enquiry is from Sorting topic in section Sorting of Data Structures & Algorithms II

1 Answer

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