1.

What is the average case time complexity of library sort?(a) O(n)(b) O(n log n)(c) O(n^2)(d) O(log n)I had been asked this question in homework.I would like to ask this question from Sorting topic in division Sorting of Data Structures & Algorithms II

Answer»

Correct ANSWER is (b) O(n log n)

Easiest EXPLANATION - Library sort USES BINARY search in order to insert elements in the sorted segment of the array which reduces its TIME complexity. So the average time complexity of library sort is O(n log n).



Discussion

No Comment Found

Related InterviewSolutions