1.

In which of the following case stooge sort is most efficient (in terms of time complexity)?(a) when input array is already sorted(b) when input array is reverse sorted(c) when input array is large(d) it has the same time complexity in any caseI have been asked this question in homework.Origin of the question is Sorting in section Sorting of Data Structures & Algorithms II

Answer»

The correct choice is (d) it has the same time complexity in any CASE

For explanation: Stooge SORT has the same time complexity under any case. It is given by the recurrence relation T(n) = 3T(2/3n) + O(1).



Discussion

No Comment Found

Related InterviewSolutions