We describe further ideas and techniques from the literature and we speculate about their possible relevance to the dynamic optimality question. Some of the described results stretch the limits of the BST model by requiring an “unreasonable” amount of memory or running time (in the spirit of the unlimited online model described in §2.2.2), or they augment the BST model with further capabilities. Studying such extended models is interesting theoretically, but ultimately we would like to be able to “simulate” them in a more realistic BST model.
2.3.1 Meta-algorithms
Multiple authors have suggested the application of general techniques from machine learning that can “simulate” and “combine” multiple algorithms from a broad family.
The best online algorithm. Iacono [53] describes an online BST algorithm that essentially “simulates” all possible online BST algorithms. This “meta-algorithm” is based on the “multi-
plicative weights update” (MWU) technique.
Informally, MWU solves the following problem: a sequence of events are revealed one by one (e.g. by nature or by the stock market). In every round, before the event is revealed, we are to choose an appropriate response for it. Depending on the suitability of our response, we receive a certain payoff (or penalty). Before every choice, we can consult a number of experts, each of whom reveal their own responses (likewise, before the event), and we can decide which one to follow. After each event, we can evaluate how each of the experts performed. The MWU technique allows us to make our choices such that our total payoff over the long term is not far from that of the best expert (with essentially no further assumptions). This is achieved by maintaining “scores” (a.k.a. “weights”) for the experts based on their past per- formance, suitably updated after every event (this is when “multiplication of weights” takes place). Experts with higher score are more likely followed in the future. For a comprehensive treatment of the MWU technique, we refer to the survey of Arora, Hazan, and Kale [8].
Let us sketch the idea of Iacono’s approach for an online BST meta-algorithm. We consider the input access sequence in epochs (i.e. contiguous subsequences) and for each epoch we choose one of the possible online algorithms to execute, using the MWU technique. (Here the access sequence within the epoch is the “event”, and the various online algorithms are the “experts”.) We also evaluate how the other online algorithms would have done on the epoch, and update their scores according to the MWU rules.
To correctly simulate an online algorithm
A
within an epoch, the meta-algorithm has to bring the tree at the beginning of the epoch into the state in whichA
would be, if it had been running from the beginning. (Our description differs here from the one in [53].) Assuming that the epochs are sufficiently long, i.e. of lengthΩ(n), the cost of this transformation at the beginning of the epoch does not affect the total cost by more than a small constant factor.The known bounds for the MWU technique tell us that over a sufficiently long sequence, the meta-algorithm does not perform much worse than “the best expert in hindsight”, i.e. it is competitive with the best online algorithm in the simulated class of algorithms. In this way, we can obtain an unlimited online algorithm whose cost matchesOPTstror evenOPTlen. We stress that the cost of the meta-algorithm includes a huge additive term, so the result holds only for sufficiently long access sequences.
The result implies that if we had a non-constructive argument for the existence of a dynamically optimal online algorithm, then we could turn it into a constructive result, i.e. into an actual online algorithm, as impractical as it may be. (Problem7asks whether a similar result can be shown in a more restricted online model.)
2.3. Other models 25
We have not specified the exact online BST model assumed for this result. From the above description it is clear that the meta-algorithm needs to reside in a model with vastly more resources than the “simulated” model. The unlimited model is clearly sufficient to simulate e.g. the strict or the lenient model. In fact, we do not need the full power of the unlimited model: as the number of possible strict or lenient online algorithms is a function of n only, the meta-algorithm can also be implemented with time and space requirement depending on n only (i.e. not on m).
Dynamic optimality? We observe that if the meta-algorithm outlined above could simulate unlimited online algorithms, then it would be dynamically optimal (since the optimum over unlimited online algorithms matchesOPT, see §2.2.2). We cannot directly do this, however, since unlimited online algorithms require unbounded memory.
Let us instead consider a more restricted family of online algorithms and see under what conditions would the meta-algorithm achieve dynamic optimality. Consider again the access sequence in epochs of length n, and let x1, . . . , xnbe the accesses in the current epoch. Consider the i th access xi, and assume that the online algorithm transforms the current tree Ti −1into the tree Ti. The transformation Ti −1→ Ti is governed by a functionΛ, i.e. Λ(Ti −1) = Ti. We letΛ depend on the current access xi, as well as on the past accesses in the current epoch, i.e. on x1, . . . , xi −1. Let
F
denote the family of online algorithms thus defined.Observe that algorithms in
F
are more restricted than unlimited online algorithms (their space requirement is a function of n only). The number of online algorithms inF
is a function of n, and therefore, the meta-algorithm outlined above can simulate this family (and match the optimum over it). Dynamic optimality boils down to whetherF
is rich enough to contain an algorithm matchingOPT. We don’t know whether this is the case; let us, however, make some simple related observations.Clearly, the optimal offline algorithm may also be assumed to perform actions depending on the current epoch only. (At the epoch boundaries we can transform the tree into a canonical state, increasing the cost by a small factor only.) Consider again the i th access
xi, and assume that the offline algorithm transforms the current tree Ti −1into the tree Ti. Whatever effect the past accesses x1, . . . , xi −1 may play on our current transformation is already captured by the current tree Ti −1. Thus, we may assume that the transformation
Ti −1→ Tiis governed by a functionΛ0that depends on the current access xi, as well as on the future accesses in the current epoch, i.e. on xi +1, . . . , xn, but not on the past accesses.
An obvious first observation is that ifΛ0 depends on xi only (and not on the future accesses), then
F
does in fact containΛ0and the meta-algorithm overF
is dynamically optimal. A more subtle point is that if the optimal offline algorithmΛ0depends on the future,but is invertible, then the inverse ofΛ0is an online algorithm from
F
, when ran backwardsin time. Since the offline optimum is invariant to reversing the access sequence, this would
also lead to a dynamically optimal online algorithm.
The requirement for the offline optimum to be invertible seems too strong. (It would mean that every tree is reachable as the next state, including those trees in which soon-to-be- accessed keys are very far from the root). It remains to be seen whether a relaxed form of this property has some relevance for the dynamic optimality question.
Strong static optimality. While the simulation-technique does not seem to solve dynamic optimality, it can be used to construct an online algorithm whose cost matches the static
optimum. (This is a special case of Iacono’s result described in the beginning of the section,
since we can restrict attention to static trees, as a special family of “online” algorithms.) Such an application of the MWU technique is also mentioned by Blum, Chawla, and Kalai [16].
Kalai and Vempala [49] derive a similar result using a related, but more practical technique, also resulting in an online algorithm that achieves strong static optimality. (The term “strong” refers to the fact thatOPTstatis matched with a constant factor arbitrarily close to 1, in contrast to Splay, which matchesOPTstatwith a larger constant factor.)
Free rotations. This model, studied by Blum, Chawla, and Kalai [16] is similar to the unlim- ited online model (§2.2.2), with the important difference that the cost of an algorithm is only the cost of access, i.e. the length of the search path, and re-arrangements can be performed for free in arbitrary parts of the tree.
Blum et al. show that in this (arguably very strong, but still online) model there is an algorithm, again using a variant of the MWU technique, whose cost in this model (i.e. not counting the re-arrangement of the tree) asymptotically matches the offline BST optimum OPTon every sequence. It remains an interesting question whether this result can be strengthened to apply in more restricted online models. In particular, it is not clear how many rotations the algorithm of Blum et al. typically performs.
2.3.2 Other models
Randomization. In both the strict and lenient online models we required algorithms to behave deterministically. It is straightforward to extend the models such that the algorithms can use a certain number of random bits for each access. (In case of the strict model, this would mean that the functionΓ can produce different re-arrangements for the same search path, depending on a parameter which we set randomly.)
It is not clear whether such an extension can significantly improve the cost of an algorithm (in expectation or with high probability). Randomized variants of Splay were studied by Fürer [46] and by Albers and Karpinski [6]. In both works the random strategies are relatively simple, e.g. deciding randomly after every access between doing the Splay re-arrangement or doing nothing, and the improvements are only by small constant factors.
Non-root access. Instead of starting every access from the root, we may allow an algorithm to start from the location of the previous access. In this model, xi +1is accessed by first going up from xito lca (xi, xi +1), then going down to xi +1, as in a normal access. Even in a static tree, this access model leads to an interesting and non-trivial optimum, studied recently by Bose, Douïeb, Iacono, and Langerman [20]. The optimum in this model is called the lazy
finger bound, and Bose et al. show that an approximation to this quantity can be expressed in
closed form. We mention this quantity again in §2.4.
It is easy to see that the lazy finger bound is at most twice the cost of normal root-access in the same static tree (since going to the lca is less costly than going to the root, and the cost of going to the root is paid for anyway by the access in the root-access model). More difficult to show is that the lazy finger bound is asymptotically not smaller than the usual offline BST optimumOPT. This is implied by the result of Demaine, Iacono, Langerman, and Özkan [33]. More strongly, the recent result of Iacono and Langerman [54] shows that the cost of Greedy, an online algorithm in the lenient model matches the lazy finger bound. We discuss this again in §2.5.3and §2.7.
The “lazy finger” approach can also be combined with rotations, i.e. it can be defined in a dynamic model. The result of Demaine, Iacono, Langerman, and Özkan [33] implies that even algorithms in this powerful dynamic lazy finger model can be simulated with a small overhead cost by algorithms in the BST model, i.e. with root-access. Surprisingly, this holds even if we allow a multiple (constant) number of fingers (i.e. pointers) to be used. (With multiple fingers, the algorithm can decide which finger to choose when performing an access,