In computer science, one approach to the dynamic optimality problem on online algorithms for binary search trees involves reformulating the problem geometrically, in terms of augmenting a set of points in the plane with as few additional points as possible to avoid rectangles with only two points on their boundary.
As typically formulated, the online binary search tree problem involves search trees defined over a fixed key set
\{1,2,...,n\}
x1,x2,
xi
Any particular algorithm for maintaining binary search trees (such as the splay tree algorithm or Iacono's working set structure) has a cost for each access sequence that models the amount of time it would take to use the structure to search for each of the keys in the access sequence in turn. The cost of a search is modeled by assuming that the search tree algorithm has a single pointer into a binary search tree, which at the start of each search points to the root of the tree. The algorithm may then perform any sequence of the following operations:
The search is required, at some point within this sequence of operations to move the pointer to a node containing the key, and the cost of the search is the number of operations that are performed in the sequence. The total cost costA(X) for algorithm A on access sequence X is the sum of the costs of the searches for each successive key in the sequence.
As is standard in competitive analysis, the competitive ratio of an algorithm A is defined to be the maximum, over all access sequences, of the ratio of the cost for A to the best cost that any algorithm could achieve:
\rhoA=\supX
costA(X) | |
costopt(X) |
.
The dynamic optimality conjecture states that splay trees have a constant competitive ratio, but this remains unproven. The geometric view of binary search trees provides a different way of understanding the problem that has led to the development of alternative algorithms that could also (conjecturally) have a constant competitive ratio.
In the geometric view of the online binary search tree problem,an access sequence
x1,...,xm
{1,2,...,n}
{(xi,i)}
xi
For example, assume the following BST on 4 nodes is given: The key set is .
Let 3, 1, 4, 2 be the access sequence.
The touches are represented geometrically: If an item x is touched in the operations for the ith access, then a point (x,i) is plotted.
A point set is said to be arborally satisfied if the following property holds: for anypair of points that do not lie on the same horizontal or vertical line, there exists a third pointwhich lies in the rectangle spanned by the first two points (either inside or on the boundary).
A point set containing the points
(xi,i)
x1,x2,...,xm
First, prove that the point set for any valid BST algorithm is arborally satisfied.Consider points
(x,i)
(y,j)
x<y
i<j
(x,i)
(y,j)
LCAt(a,b)
LCAi(x,y)\nex
(LCAi(x,y),i)
LCAi(x,y)
LCAj(x,y)\ney
(LCAj(x,y),j)
(i\lek<j)
(y,k)
Next, show the other direction: given an arborally satisfied point set, a valid BST corresponding to that point set can be constructed. Organize our BST into a treap which is organized in heap-order by next-touch-time. Note that next-touch-time has ties and is thus not uniquely defined, but this isn’t a problem as long as there is a way to break ties. When time reached, the nodes touched form a connected subtree at the top, by the heap ordering property. Now, assign new next-touch-times for this subtree, and rearrange it into a new local treap.If a pair of nodes, and, straddle the boundary between the touched and untouched partof the treap, then if is to be touched sooner than then
(x,now)\to(y,next-touch(y))
Finding the best BST execution for the input sequence
x1,x2,...,xm
The following greedy algorithm constructs arborally satisfiable sets:
y=i
y\gei
(xi,i)
y=i
The algorithm has been conjectured to be optimal within an additive term.[1]
The geometry of binary search trees has been used to provide an algorithm which is dynamically optimal if any binary search tree algorithm is dynamically optimal.[2]
. 10.1007/978-3-642-40273-9_16 . 8066 . 236–250 . Lecture Notes in Computer Science . 2013 . Space-Efficient Data Structures, Streams, and Algorithms . In Pursuit of the Dynamic Optimality Conjecture . John Iacono . 978-3-642-40272-2 . 1306.0207 . 2013arXiv1306.0207I. 14729858 .