Number of rotations needed to convert a BST into a perfectly balanced BST?
-
A
O(log n)
-
B
O(n)
Correct answer
-
C
O(n log n)
-
D
O(1)
15 views
Explanation
At most O(n) left/right rotations suffice.
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ