1.

What is the auxiliary space requirement of Tim sort?(a) O(n)(b) O(n log n)(c) O(n^2)(d) O(log n)This question was posed to me by my school principal while I was bunking the class.Query is from Sorting in portion Sorting of Data Structures & Algorithms II

Answer»

The correct choice is (a) O(N)

Best EXPLANATION: TIM SORT is a hybrid of merge sort and insertion sort. It requires to merge SORTED runs which require a third array of the size equal to the sum of the two runs. So in worst case the auxiliary space requirement will be O(n).



Discussion

No Comment Found

Related InterviewSolutions