Is it O(1) or O(logN) but with a smaller coefficient?
If this is unspecified, I'd at least like to know the answer based on a reasonable supposition that the map/set is implemented using a red-black or AVL tree. The general algorithm to insert an element, I think, is something like:
- find the right place - O(logN)
- do the actual insertion - ?
- rebalance the tree if necessary - ?
Now if we provide the correct iterator hint, then the first step becomes O(1). Are the other steps also O(1) or O(logN)?