from typing import Dict, List, Optional, Tuple
from pyutils import dict_utils
from typing import Dict, List, Optional, Tuple
from pyutils import dict_utils
fast addition of new numbers (:math:`O(2log_2 n)`) and instant access to the
median value in the population (:math:`O(1)`). It also provides other population
summary statistics such as the :meth:`get_mode`, :meth:`get_percentile` and
fast addition of new numbers (:math:`O(2log_2 n)`) and instant access to the
median value in the population (:math:`O(1)`). It also provides other population
summary statistics such as the :meth:`get_mode`, :meth:`get_percentile` and
elif len(self.highers) - len(self.lowers) > 1:
heappush(self.lowers, -heappop(self.highers))
elif len(self.highers) - len(self.lowers) > 1:
heappush(self.lowers, -heappop(self.highers))
"""
Returns: the number at approximately pn% in the population
(i.e. the nth percentile) in :math:`O(n log_2 n)` time (it
"""
Returns: the number at approximately pn% in the population
(i.e. the nth percentile) in :math:`O(n log_2 n)` time (it