1.

What is the worst case time complexity of bogosort?(a) O(n^2)(b) O(n*n!)(c) O(infinity)(d) O(n log n)This question was addressed to me in an interview for internship.My doubt is from Sorting in division Sorting of Data Structures & Algorithms II

Answer»

The correct option is (c) O(infinity)

For EXPLANATION: There is no upper bound to the worst case of this ALGORITHM. It can go on to TAKE very large amount of time if the array has many elements. So the worst case of this algorithm can be TAKEN as O(infinity).



Discussion

No Comment Found

Related InterviewSolutions