1.

What is the best case time complexity of cocktail sort?(a) O(n)(b) O(n log n)(c) O(n^2)(d) O(log n)I got this question during an interview for a job.My doubt stems from Sorting topic in division Sorting of Data Structures & Algorithms II

Answer»

The correct OPTION is (a) O(N)

The explanation is: Best case complexity is OBSERVED when the input array is ALREADY sorted. This is the same as the best case complexity of bubble SORT.



Discussion

No Comment Found

Related InterviewSolutions