What is the time complexity of adding an element to a `TreeSet`?
The time complexity is O(log n) because `TreeSet` uses a balanced tree structure to insert elements in sorted order.
That's correct! You've got the time complexity of insertion right.
How does the Red-Black Tree structure in `TreeSet` maintain balance during insertions?