4 research outputs found

    A strategy for searching with different access costs

    Get PDF
    AbstractLet us consider an ordered set of keys A={a1<⋯<an}, where the probability of searching ai is 1/n, for i=1,…,n. If the cost of testing each key is similar, then the standard binary search is the strategy with minimum expected access cost. However, if the cost of testing ai is ci, for i=1,…,n, then the standard binary search is not necessarily the best strategy.In this paper, we prove that the expected access cost of an optimal search strategy is bounded above by 4Cln(n+1)/n, where C=∑i=1nci. Furthermore, we show that this upper bound is asymptotically tight up to constant factors. The proof of this upper bound is constructive and generates a 4ln(n+1)-approximated algorithm for constructing near-optimal search strategies. This algorithm runs in O(n2) time and requires O(n) space, which can be useful for practical cases, since the best known exact algorithm for this problem runs in O(n3) time and requires O(n2) space

    Optimal binary trees with height restrictions on left and right branches

    Get PDF
    We begin with background definitions on binary trees. Then we review known algorithms for finding optimal binary search trees. Knuth\u27s famous algorithm, presented in the second chapter, is the cornerstone for our work. It depends on two important results: the Quadrangle Lemma and the Monoticity Theorem. These enabled Knuth to achieve a time complexity of O(n2), while previous algorithms had been O(n3) (n = size of input). We present the known generalization of Knuth\u27s algorithm to trees with a height restriction. Finally, we consider the previously unexamined case of trees with different restrictions on left and right heights. We prove the Quadrangle Lemma and the Monoticity Theorem in this case, and present an algorithm based on this
    corecore