sortedlist
Source code: sortedlist.seq
-
sortedlist.DEFAULT_LOAD_FACTOR
-
class sortedlist.SortedList[T]
Properties:
Magic methods:
-
__init__()
-
__iter__()
-
__len__()
-
__bool__()
Methods:
-
clear()
Remove all values from sorted list.
Runtime complexity: O(n)
-
add(value: T)
Add value to sorted list.
Runtime complexity: O(log(n)) – approximate.
>>> sl = SortedList()
>>> sl.add(3)
>>> sl.add(1)
>>> sl.add(2)
>>> sl
SortedList([1, 2, 3])
:param value: value to add to sorted list