1.

Auxiliary space requirement of cocktail sort is _____________(a) O(n)(b) O(log n)(c) O(1)(d) O(n^2)I have been asked this question in an internship interview.This intriguing question originated from Sorting topic in chapter Sorting of Data Structures & Algorithms II

Answer»

Right CHOICE is (c) O(1)

Best explanation: In COCKTAIL sort manipulation is done on the input array itself. So no extra space is REQUIRED to perform sorting. Thus it requires CONSTANT auxiliary space.



Discussion

No Comment Found

Related InterviewSolutions