A transactional data structure to maintain an ordered sequence of elements such
that two random elements can be compared in O(1).
This uses an algorithm from the paper
Bender, M. and Cole, R. and Demaine, E. and Farach-Colton, M. and Zito, J.,
Two simplified algorithms for maintaining order in a list,
Algorithms—ESA 2002, pp. 219--223, 2002.
The relabel method is based on the Python implementation by
David Eppstein, as published at http://www.ics.uci.edu/~eppstein/PADS/OrderedSequence.py
however a bug resulting in a relabel size of 1 was fixed.
Original note: "Due to rebalancing on the integer tags used to maintain order,
the amortized time per insertion in an n-item list is O(log n)."
A transactional data structure to maintain an ordered sequence of elements such that two random elements can be compared in O(1).
This uses an algorithm from the paper Bender, M. and Cole, R. and Demaine, E. and Farach-Colton, M. and Zito, J., Two simplified algorithms for maintaining order in a list, Algorithms—ESA 2002, pp. 219--223, 2002.
The
relabel
method is based on the Python implementation by David Eppstein, as published at http://www.ics.uci.edu/~eppstein/PADS/OrderedSequence.py however a bug resulting in a relabel size of 1 was fixed.Original note: "Due to rebalancing on the integer tags used to maintain order, the amortized time per insertion in an n-item list is O(log n)."