
unit travel cost. The key value of a node is only revealed when the agent visits it, and thus the
problem has an online nature. When the agent learns the key value of a node, it still does not
know the rank of this value.
The selection problem for ordinary heaps, which allow for random access (i.e., jumping to
arbitrary nodes in the tree for “free”), has also been studied. In this model, it was shown
by [Fre93] that selecting the nth minimum can be achieved deterministically in O(n)time using
O(n)workspace. We note that in both models, Ω(n)is a natural lower bound. This is because
verifying that a value Lis the nth minimum requires Θ(n)time – one must at least inspect the
nnodes with value at most L– which can be done via straightforward depth-first search.
A simple selection strategy is to use the best-first rule2, which repeatedly explores the un-
explored node whose parent has the smallest key value. While this rule is optimal in terms of
the number of nodes that it explores, namely Θ(n), the distance traveled by the agent can be
far from optimal. In the worst-case, an agent using this rule will need to travel a distance of
Θ(n2)to find the nth smallest value. A simple bad example for this rule is to consider a rooted
tree consisting of two paths (which one can extend to a binary tree), where the two paths are
consecutively labeled by all positive even and odd integers respectively. Moreover, the space
complexity becomes Ω(n)in general when using the best-first rule, because essentially all the
explored nodes might need to be kept in memory. We note that irrespective of computational
considerations on the agent, either in terms of working memory or running time restrictions,
minimizing the total travel distance in explorable heap selection remains a challenging online
problem.
Improving on the best-first strategy, Karp, Saks and Wigderson [KSW86] gave a randomized
algorithm with expected cost n·exp(O(plog(n))) using O(plog(n)) working space. They also
showed how to make the algorithm deterministic using O(log(n)2.5)space. In this work, our
main contribution is an improved randomized algorithm with expected cost O(nlog(n)3)using
O(log(n)) space. Given the Ω(n)lower bound, our travel cost is optimal up to logarithmic factors.
Furthermore we show that any algorithm for explorable heap selection that uses only sunits of
memory, must take at least n·logs(n)time in expectation. An interesting open problem is the
question whether a superlinear lower bound also holds without any restriction on the memory
usage.
To clarify the memory model, it is assumed that any key value and O(log n)bit integer can be
stored using O(1) space. We also assume that maintaining the current position in the tree does
not take up memory. Furthermore, we assume that key value comparisons and moving across
an edge of the tree require O(1) time. Under these assumptions, the running times of the above
algorithms happen to be proportional to their travel cost. Throughout the paper, we will thus
use travel cost and running time interchangeably.
Motivation The motivation to look at this problem comes from the branch-and-bound algo-
rithm. This is a well-known algorithm that can be used for solving many types of problems.
In particular, it is often used to solve integer linear programs (IPs), which are of the form
arg min{c⊤x:x∈Zn, Ax ≤b}. In that setting, branch-and-bound works by first solving the
linear programming (LP) relaxation, which does not have integrality constraints. The value of
the solution to the relaxation forms a lower bound on the objective value of the original prob-
lem. Moreover, if this solution only has integral components, it is also optimal for the original
problem. Otherwise, the algorithm chooses a component xifor which the solution value ˆxiis
not integral. It then creates two new subproblems, by either adding the constraint xi≤ ⌊ˆxi⌋or
xi≥ ⌈ˆxi⌉. This operation is called branching. The tree of subproblems, in which the children of
2Frederickson’s algorithm [Fre93] is in fact a highly optimized variant of this rule
2