In this video we analyze the runtime complexity of inserting N items inside an empty std::set.
We know that sets are implemented using red-black trees, and inserting an item inside a set is O(log (s.size())). What is the complexity of inserting N items inside an empty set?
We will provide both an upper bound (Big Oh) and a lower bound (Big Omega), which will give us a tight lower and upper bound and big theta Θ.
To do this, we use Stirling Approximation (https://en.wikipedia.org/wiki/Stirlin...) to get a close estimate of n!.
When doing runtime analysis:
You are often asked to find Big Theta, not Big O.
Try to find a tight bound.
Loose bounds are correct, but not useful.
Try to find an equality relation, not an inequality.