1.

What is the worst case time complexity of tree sort (when implemented with an unbalanced tree)?(a) O(n)(b) O(n log n)(c) O(n^2)(d) O(log n)I got this question in an internship interview.The query is from Sorting topic in section Sorting of Data Structures & Algorithms II

Answer»

Right answer is (C) O(n^2)

For explanation: The worst CASE time COMPLEXITY of TREE sort depends on whether the tree USED in the implementation is balanced or not. If the tree is unbalanced then the worst case complexity is O(n^2).



Discussion

No Comment Found

Related InterviewSolutions