1.

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

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.



Discussion

No Comment Found

Related InterviewSolutions