If we have a BST but want to keep it balanced, how much more expensive does adding an element to it become? Clearly adding an element (without maintaining balance) is of time complexity O(log(n)), as we traverse the tree down to the point where we should add the element, but if we want to maintain a balanced tree such that our worse case search time remains O(log(n)), how much more expensive are the operations of
- Checking if our tree is balanced after we have added an element
- Balancing the tree through left or right rotations if it is now unbalanced. Thanks