What is the time complexity of looking up a value in a balanced BST?

What is the time complexity of looking up a value in a balanced BST?

Approach: Analyze tree height.

O(log n). Since the tree is balanced, the height is logarithmic relative to the number of nodes.

Follow-up: What happens to complexity if the tree is unbalanced?

Key concepts: logarithmic time, tree height.