Algorithms and Data Structures · Junior · Question 50 of 75
What is the time to find a value in a balanced BST with n nodes?
- ✓Correct answer: O(log n)
- 2O(n)
- 3O(1)
Explanation
Each step goes down one level, and a balanced tree has about log₂ n levels. If the tree degenerates into a chain (for example, after inserting sorted values), search becomes O(n).