1.

What is the best case time complexity of permutation sort?(a) O(n^2)(b) O(n)(c) O(n log n)(d) O(1)I had been asked this question in exam.This intriguing question originated from Sorting in section Sorting of Data Structures & Algorithms II

Answer»

The correct answer is (B) O(n)

EASY explanation - Best case time complexity of permutation sort occurs when the INPUT array is already sorted. So in such a case we only NEED to check whether all the elements are sorted which can be done in O(n) time.



Discussion

No Comment Found

Related InterviewSolutions