1.

What is the worst case time complexity of bucket sort (k = number of buckets)?(a) O(n + k)(b) O(n.k)(c) O(n^2)(d) O(n log n)The question was posed to me in a job interview.I'd like to ask this question from Sorting topic in section Sorting of Data Structures & Algorithms II

Answer»

Right option is (c) O(n^2)

For EXPLANATION: Time complexity of bucket sort is O(n^2) in the worst case. So if bucket sort does not GET the INPUTS in the DESIRED manner then it BECOMES very inefficient.



Discussion

No Comment Found

Related InterviewSolutions