English

Optimal Preprocessing for Answering On-Line Product Queries

Data Structures and Algorithms 2024-06-11 v1

Abstract

We examine the amount of preprocessing needed for answering certain on-line queries as fast as possible. We start with the following basic problem. Suppose we are given a semigroup (S,)(S,\circ ). Let s1,,sns_1 ,\ldots, s_n be elements of SS. We want to answer on-line queries of the form, ``What is the product sisi+1sj1sjs_i \circ s_{i+1} \circ \cdots \circ s_{j-1} \circ s_j?'' for any given 1ijn1\le i\le j\le n. We show that a preprocessing of Θ(nλ(k,n))\Theta(n \lambda (k,n)) time and space is both necessary and sufficient to answer each such query in at most kk steps, for any fixed kk. The function λ(k,)\lambda (k,\cdot) is the inverse of a certain function at the k/2\lfloor {k/2}\rfloor-th level of the primitive recursive hierarchy. In case linear preprocessing is desired, we show that one can answer each such query in O(α(n))O( \alpha (n)) steps and that this is best possible. The function α(n)\alpha (n) is the inverse Ackermann function. We also consider the following extended problem. Let TT be a tree with an element of SS associated with each of its vertices. We want to answer on-line queries of the form, ``What is the product of the elements associated with the vertices along the path from uu to vv?'' for any pair of vertices uu and vv in TT. We derive results that are similar to the above, for the preprocessing needed for answering such queries. All our sequential preprocessing algorithms can be parallelized efficiently to give optimal parallel algorithms which run in O(logn)O(\log n) time on a CREW PRAM. These parallel algorithms are optimal in both running time and total number of operations. Our algorithms, especially for the semigroup of the real numbers with the minimum or maximum operations, have various applications in certain graph algorithms, in the utilization of communication networks and in Database retrieval.

Keywords

Cite

@article{arxiv.2406.06321,
  title  = {Optimal Preprocessing for Answering On-Line Product Queries},
  author = {Noga Alon and Baruch Schieber},
  journal= {arXiv preprint arXiv:2406.06321},
  year   = {2024}
}

Comments

This manuscript appeared originally as TR 71/87, the Moise and Frida Eskenasy Institute of Computer Science, Tel Aviv University (1987)

R2 v1 2026-06-28T16:59:41.972Z