Does python has any data structure corresponding to map and set in C++ STL?

The data structure should achieve:

  1. The Numbers inside are always kept in order.
  2. The complexity of insertion and deletion is O(longn).
  3. We can get the minimum(maximal) number in O(1) time.

If not, how can it be implemented conveniently using python?

I ask this question because I can't write the correct answer in python code when I'm doing google kickstart 2019 round D, promble A.
https://codingcompetitions.withgoogle.com/kickstart/round/0000000000051061/0000000000161426

Comments (2)