By maintaining elements in a balanced binary search tree, typically an AVL or red-black tree.