API Reference / Modules / sortedlist sortedlist Standard library module View source variable DEFAULT_LOAD_FACTOR DEFAULT_LOAD_FACTOR = 1000 class SortedList class SortedList[T] View complete class API → Fields 1 T type Constructors 1 __init__ __init__(self) Properties 1 left @property left(self) Methods 2 clear clear(self) Remove all values from sorted list. Runtime complexity: $O(n)$ add add(self, 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]) Special methods 3 __iter__ __iter__(self) __len__ __len__(self) __bool__ __bool__(self)
class SortedList class SortedList[T] View complete class API → Fields 1 T type Constructors 1 __init__ __init__(self) Properties 1 left @property left(self) Methods 2 clear clear(self) Remove all values from sorted list. Runtime complexity: $O(n)$ add add(self, 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]) Special methods 3 __iter__ __iter__(self) __len__ __len__(self) __bool__ __bool__(self)