Interleave lower bound

In the theory of optimal binary search trees, the interleave lower bound is a lower bound on the number of operations required by a Binary Search Tree (BST) to execute a given sequence of accesses.

Several variants of this lower bound have been proven.{{Cite journal | doi = 10.1137/0218004| title = Lower Bounds for Accessing Binary Search Trees with Rotations| journal = SIAM Journal on Computing| volume = 18| pages = 56–67| year = 1989| last1 = Wilber | first1 = R. }}{{Cite journal | doi = 10.1137/S0097539795291598| title = Optimal Biweighted Binary Trees and the Complexity of Maintaining Partial Sums| journal = SIAM Journal on Computing| volume = 28| pages = 1–9| year = 1998| last1 = Hampapuram | first1 = H. | last2 = Fredman | first2 = M. L. }}{{Cite journal | doi = 10.1137/S0097539705447256| url = http://erikdemaine.org/papers/DynamicConnectivity_SICOMP/paper.pdf | title = Logarithmic Lower Bounds in the Cell-Probe Model| journal = SIAM Journal on Computing| volume = 35| issue = 4| pages = 932| year = 2006| last1 = Patrascu | first1 = M. | last2 = Demaine | first2 = E. D. | arxiv = cs/0502041}} This article is based on a variation of the first Wilber's bound.{{Cite journal | doi = 10.1137/S0097539705447347| url = http://erikdemaine.org/papers/Tango_SICOMP/paper.pdf | title = Dynamic Optimality—Almost| journal = SIAM Journal on Computing| volume = 37| pages = 240–251| year = 2007| last1 = Demaine | first1 = E. D. | last2 = Harmon | first2 = D. | last3 = Iacono | first3 = J. | last4 = Pătraşcu | first4 = M. }} This lower bound is used in the design and analysis of Tango tree. Furthermore, this lower bound can be rephrased and proven geometrically, Geometry of binary search trees.{{Citation

|title=The geometry of binary search trees

|first1=Erik D. | last1=Demaine | author1-link = Erik Demaine

|first2=Dion | last2=Harmon

|first3=John | last3=Iacono | author3-link=John Iacono

|first4=Daniel | last4=Kane | author4-link=Daniel Kane (mathematician)

|first5=Mihai | last5=Pătraşcu | author5-link=Mihai Pătrașcu (computer scientist)

|year=2009

|journal=In Proceedings of the 20th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2009)

|url=http://erikdemaine.org/papers/BST_SODA2009/

|doi=10.1137/1.9781611973068.55

|location=New York | pages=496–505|isbn=978-0-89871-680-1 |doi-access=free}}

Definition

The bound is based on a fixed perfect BST P , called the lower bound tree, over the keys \{1, 2,..., n \}. For example, for n = 7 , P can be represented by the following parenthesis structure:

::[([1] 2 [3]) 4 ([5] 6 [7])]

For each node y in P , define:

  • Left(y) to be the set of nodes in the left sub-tree of y , including y .
  • Right(y) to be the set of nodes in the right sub-tree of y .

Consider the following access sequence: X = x_1, x_2, ..., x_m . For a fixed node y , and for each access x_i , define the label of x_i with respect to y as:

  • "L" - if x_i is in Left(y) .
  • "R" - if x_i is in Right(y) ;
  • Null - otherwise.

The label of y is the concatenation of the labels from all the accesses. For example, if the sequence of accesses is: 7,6,3 then the label of the root (4) is: "RRL", the label of 6 is: "RL", and the label of 2 is: "R".

For every node y , define the amount of interleaving through y as the number of alternations between L and R in the label of y . In the above example, the interleaving through 4 and 6 is 1 and the interleaving through all other nodes is 0 .

The interleave bound, \mathit{IB}(X), is the sum of the interleaving through all the nodes of the tree. The interleave bound of the above sequence is 2 .

The Lower Bound Statement and its Proof

The interleave bound is summarized by the following theorem.

{{math_theorem| Let X be an access sequence. Denote by IB(X) the interleave bound of X , then \mathit{IB}(X)/2 - n is a lower bound of OPT(X), the cost of optimal offline BST that serves X.

}}

The following proof is based on.

= Proof =

Let X = x_1,x_2,...,x_m be an access sequence. Denote by T_i the state of an arbitrary BST at time i i.e. after executing the sequence x_1,x_2,...,x_i . We also fix a lower bound BST P.

For a node y in P , define the transition point for y at time i to be the minimum-depth node z in the BST T_i such that the path from the root of T_i to z includes both a node from Left(y) and a node from Right(y). Intuitively, any BST algorithm on T_i that accesses an element from Right(y) and then an element from Left(y) (or vice versa) must touch the transition point of y at least once. In the following Lemma, we will show that transition point is well-defined.

{{math_theorem|name=Lemma 1|math_statement= The transition point of a node y in P at a time i exists and it is unique.}}

{{Math proof|

Define \ell to be the lowest common ancestor of all nodes in T_i that are in Left(y).

Given any two nodes a < b in T_i , the lowest common ancestor of a and b , denoted by lca(a, b) , satisfies the following inequalities. a \leq lca(a, b) \leq b . Consequently, \ell is in Left(y), and \ell is the unique node of minimum depth in T_i . Same reasoning can be applied for r , the lowest common ancestor of all nodes in T_i that are in Right(y). In addition, the lowest common ancestor for all the points in Left(y) and right(y) is also in one of these sets.

Therefore, the unique minimum depth node must be among the nodes of Left(y) and right(y). More precisely, it is either \ell or r . Suppose, it is \ell . Then, \ell is an ancestor of r . Consequently, r is a transition points since the path from the root to r contains \ell . Moreover, any path in T_i from the root to a node in the sub-tree of y must visit \ell because it is the ancestor of all such nodes, and for any path to a node in the right region must visit r because it is lowest common ancestor of all the nodes in right(y). To conclude, r is the unique transition point for y in T_i .

}}

The second lemma that we need to prove states that the transition point is stable. It will not change until it is touched.

{{math_theorem|name=Lemma 2|math_statement= Given a node y. Suppose z is the transition point of y at a time j . If an access algorithm for a BST does not touch z in T_i for i \in [j, k], then the transition point of y will remain z in T_i for i \in [j, k]. }}

{{Math proof|

Consider the same definition for \ell and r as in Lemma 1. Without loss of generality, suppose also that \ell is an ancestor of r in the BST at time j , denoted by T_j . As a result, r will be the transition point of y . By hypothesis, the BST algorithm does not touch the transition point, in our case r , for the entirety of [j, k] . Therefore, it does not touch any node in Right(y). Consequently, r remains the lowest common ancestor for any two nodes in Right(y). However, the access algorithm might touch a node in Left(y). More precisely, it might touch the lowest common ancestor of all nodes in Left(y) at a time i , which we will denoted by \ell_i .

Even so, \ell_i will remain the ancestor of r for the following reasons:

Firstly, observe that any node of Left(y) that was outside the tree rooted at r at time j cannot enter this tree at a time i \in [j, k] , since r isn't touched in this time frame.

Secondly, there exists at least one node \ell_i' in Left(y) outside the tree rooted at r , for any time i \in [j, k] . This is since \ell was initially outside r 's sub-tree, and no nodes from outside the tree can enter it in this timeframe. Now, consider a_i = lca(\ell_i', r) . a_i cannot be r since \ell_i' is not in the sub-tree of r . So, a_i must be in Left(y), since \ell_i' \leq a_i \leq r . Consequently \ell_i must be an ancestor of a_i and by consequence an ancestor of r at time i . Therefore, there always exists a node in Left(y) on the path from the root to r , and as such r remains the transition point.

}}

The last Lemma toward the proof states that every node y \in P has its unique transition point.

{{math_theorem|name=Lemma 3| math_statement= Given a BST at time i , T_i , any node y in T_i can be only a transition for at most one node in P .}}

{{Math proof|

Given two distinct nodes y_1, y_2 \in P . Let r_1, \ell_1, r_2, \ell_2 be the lowest common ancestor of Right(y_1), Left(y_1), Right(y_2), Left(y_2) respectively.

From Lemma 1, we know that the transition point of y_i is either \ell_i or r_i for i \in \{1, 2\} . Now we have two main cases to consider.

Case 1: There is no ancestrally relation between y_1 and y_2 in P . Consequently, the Left(y_1), Left(y_2), Right(y_1), and Right(y_2) are all disjoint. Thus, r_1 \neq r_2 \neq \ell_1 \neq \ell_2 , and the transition points are different.

Case 2: Suppose without loss of generality that y_1 is an ancestor of y_2 in P .

Case 2.1: Suppose that the transition point of y_1 is not in the tree rooted at y_2 in P . Thus, it is different from \ell_2 and r_2 , and consequently the transition point of y_2 .

Case 2.2: The transition point of y_1 is in the tree rooted at y_2 in P . More precisely, it is one of the lowest common ancestor of Left(y_2) and right(y_2) . In other words, it is either \ell_2 or r_2 .

Suppose a_1 is the lowest common ancestor of the sub-tree rooted at y_1 and does not contain y_2 . We have \ell_2 and r_2 deeper than a_1 because one of them is the transition point. Suppose that \ell_2 is the transition point. Then, \ell_2 is less deep that r_2 . In this case, \ell_2 is the transition point of y_1 and r_2 is the transition point of y_2 . Similar reasoning applies if r_2 is less deep that \ell_2 . In sum, the transition point of y_1 is the less deep from \ell_2 and r_2 , and y_2 has the deeper one as a transition point.

In conclusion, the transition points are different in all the cases.

}}

Now, we are ready to prove the theorem. First of all, observe that the number of touched transition points by the offline BST algorithm is a lower bound on its cost, we are counting less nodes than the required for the total cost.

We know by Lemma 3 that at any time i , any node y in T_i can be only a transition for at most one node in P . Thus, It is enough to count the number of touches of a transition node of y , the sum over all y .

Therefore, for a fixed node y \in P , let \ell and r to be defined as in Lemma 1. The transition point of y is among these two nodes. In fact, it is the deeper one. Let x_{i_{1}}, x_{i_{2}}, ..., x_{i_p} be a maximal ordered access sequence to nodes that alternate between Left(y) and Right(y) . Then p is the amount of interleaving through the node y . Suppose that the even indexed accesses are in the Left(y) , and the odd ones are in Right(y) i.e. x_{i_{2j}} \in Left(y) and x_{i_{2j - 1}} \in Right(y) . We know by the properties of lowest common ancestor that an access to a node in Left(y) , it must touch \ell . Similarly, an access to a node in Right(y) must touch r . Consider every j \in [1, \lfloor p/2 \rfloor] . For two consecutive accesses x_{i_{2j - 1}} and x_{i_{2j}} , if they avoid touching the access point of y , then \ell and r must change in between. However, by Lemma 2, such change requires touching the transition point. Consequently, the BST access algorithm touches the transition point of y at least once in the interval of [i_{2j - 1}, i_{2j}] . Summing over all j \in [1, \lfloor p/2 \rfloor ] , the best algorithm touches the transition point of y at least \lfloor p/2 \rfloor \geq p/2 - 1. Summing over all y ,

\sum_{y \in P} p_y/2 - 1 \geq IB(X)/2 - n

where p_y is the amount of interleave through y . By definition, the p_y's add up to IB(X) . That concludes the proof.

See also

References