What is the time complexity of inserting an element into an AVL tree?
16 views
- O(n)
- O(log n) (Correct Answer)
- O(n log n)
- O(1)
Explanation
AVL trees maintain height balance through rotations, ensuring the height remains O(log n). Thus, insertion involves traversal and rebalancing operations within logarithmic time complexity.