What is the best case time complexity of the binary tree sort?

What is the best case time complexity of the binary tree sort?
A. O(n)
B. O(nlogn)
C. O(n$^{2}$)
D. O(logn)
 
Answer: b
Explanation: The best case occurs when the BST is balanced. So, when tree is balanced we require O(nlogn) time to build the tree and O(n) time to traverse the tree. So, the best case time complexity of the binary tree sort is O(nlogn).
 

Tìm kiếm

Back
Top