To prevent the "Skewed Tree" problem, we use self-balancing trees. They use Rotations to ensure the tree height never exceeds Log(N).
In an AVL tree, the height difference between left and right children can be at most 1. It is very strict, which makes it faster for searching but slower for inserting/deleting because it has to rotate constantly.
Red-Black trees use a color-based rule (Black nodes, Red nodes) to ensure the tree is "approximateley" balanced. The longest path is never more than twice the shortest path. This makes it slightly slower at searching than AVL, but much faster at inserting and deleting.
The .NET SortedDictionary<K, V> and SortedSet<T> use Red-Black Trees internally because they provide a great balance for general-purpose applications.
Q: "What is a Tree Rotation, and why is it O(1)?"
Architect Answer: "A rotation is a pointer manipulation that changes the root of a subtree without changing the In-Order sort of the data. Because you only swap 3 or 4 pointers, the cost is constant (O(1)), regardless of how many millions of nodes are in the tree. This is why self-balancing trees can stay fast even as the database grows to terabytes."