Skip to content

module sortedlist

Source: stdlib/sortedlist.codon


DEFAULT_LOAD_FACTOR = 1000


SortedList[T]

Fields

T: type

Properties

left @property Method is a class property

Magic methods

__init__(self)

__iter__(self)

__len__(self)

__bool__(self)

Methods

clear(self)

Remove all values from sorted list. Runtime complexity: \(O(n)\)

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])