In computer science, the order-maintenance problem involves maintaining a totally ordered set supporting the following operations:
insert(X, Y), which inserts X immediately after Y in the total order; order(X, Y), which determines if X precedes Y in the total order; and delete(X), which removes X from the set. Paul Dietz first introduced a data structure to solve this problem in 1982. This data structure supports insert(X, Y) in O ( log n ) {\displaystyle O(\log n)} (in Big O notation) amortized time and order(X, Y) in constant time but does not support deletion. Athanasios Tsakalidis used BB[α] trees with the same performance bounds that supports deletion in O ( log n ) {\displaystyle O(\log n)} and improved insertion and deletion performance to
O ( 1 ) {\displaystyle O(1)} amortized time with indirection. Dietz and Daniel Sleator published an improvement to worst-case constant time in 1987. Michael Bender, Richard Cole and Jack Zito published significantly simplified alternatives in 2002. Bender, Fineman, Gilbert, Kopelowitz and Montes also published a deamortized solution in 2017. Efficient data structures for order-maintenance have applications in many areas, including data structure persistence, graph algorithms and fault-tolerant data structures.
List labeling
A problem related to the order-maintenance problem is the list-labeling problem in which instead of the order(X, Y) operation the solution must maintain an assignment of labels from a universe of integers { 1 , 2 , … , m } {\displaystyle \{1,2,\ldots ,m\}} to the elements of the set such that X precedes Y in the total order if and only if X is assigned a lesser label than Y. It must also support an operation label(X) returning the label of any node X. Note that order(X, Y) can be implemented simply by comparing label(X) and label(Y) so that any solution to the list-labeling problem immediately gives one to the order-maintenance problem. In fact, most solutions to the order-maintenance problem are solutions to the list-labeling problem augmented with a level of data structure indirection to improve performance. We will see an example of this below. For a list-labeling problem on sets of size up to n {\displaystyle n} , the cost of list labeling depends on how large m {\displaystyle m} is a function of n {\displaystyle n} . The relevant parameter range for order maintenance are for m = n 1 + Θ ( 1 ) {\displaystyle m=n^{1+\Theta (1)}} , for which an O ( log n ) {\displaystyle O(\log n)} amortized cost solution is known, and 2 Ω ( n ) {\displaystyle 2^{\Omega (n)}} for which a constant time amortized solution is known
O(1) amortized insertion via indirection Indirection is a technique used in data structures in which a problem is split into multiple levels of a data structure in order to improve efficiency. Typically, a problem of size n {\displaystyle n} is split into
n / log n {\displaystyle n/\log n} problems of size log n {\displaystyle \log n} . For example, this technique is used in y-fast tries. This strategy also works to improve the insertion and deletion performance of the data structure described above to constant amortized time. In fact, this strategy works for any solution of the list-labeling problem with O ( log n ) {\displaystyle O(\log n)} amortized insertion and deletion time.
… excerpt ends here. Continue reading the full article.

