This paper presents a general technique for optimally transformingany dynamic data structure that operates on atomic and indivisiblekeys by constant-time comparisons, into a data structure thathandles unbounded-length keys whose comparison cost is not aconstant. Examples of these keys are strings, multidimensionalpoints, multiple-precision numbers, multikey data (e.g., records),XML paths, URL addresses, etc. The technique is more general thanwhat has been done in previous work as no particular exploitation ofthe underlying structure is required. The only requirement isthat the insertion of a key must identify its predecessor or itssuccessor.Using the proposed technique, online suffix tree construction can bedone in worst case time $O(\log n)$ per input symbol (as opposed toamortized $O(\log n)$ time per symbol, achieved by previously knownalgorithms). To our knowledge, our algorithm is the first thatachieves $O(\log n)$ worst case time per input symbol. Searching fora pattern of length $m$ in the resulting suffix tree takes $O(\min(m \log |\Sigma|, m + \log n) + tocc)$ time, where $tocc$ is the numberof occurrences of the pattern. The paper also describes moreapplications and shows how to obtain alternative methods for dealingwith suffix sorting, dynamic lowest common ancestors, and ordermaintenance.The technical features of the proposed technique for a given datastructure $\mathscr{D}$ are the following ones. The new datastructure $\mathscr{D}'$ is obtained from $\mathscr{D}$ by augmenting the latterwith an oracle for strings, extending the functionalities of theDietz--Sleator list for ordermaintenance [P. F. Dietz and D. D. Sleator, Proceedings of the Nineteenth Annual ACM Symposium on Theory ofComputing , ACM, New York, 1987, pp. 365--372; A. Tsakalidis, Acta Inform. , 21 (1984), pp. 101--112].The space complexityof $\mathscr{D}'$ is $\mathscr{S}(n) + O(n)$ memory cells for storing $n$ keys,where $\mathscr{S}(n)$ denotes the space complexity of $\mathscr{D}$. Then, eachoperation involving $O(1)$ keys taken from $\mathscr{D}'$ requires$O(\mathscr{T}(n))$ time, where $\mathscr{T}(n)$ denotes the timecomplexity of the corresponding operation originally supportedin $\mathscr{D}$. Each operation involving a key $y$ not stored in$\mathscr{D}'$ takes $O(\mathscr{T}(n) + |y|)$ time, where $|y|$ denotesthe length of $y$. For the special case where the oracle handlessuffixes of a string, the achieved insertion time is$O(\mathscr{T}(n))$.
Consider an input text string T ≡ T[1,N] drawn from an unbounded alphabet, so text positions can be accessed using comparisons. We study partial computation in suffix-based problems for Data Compression and Text Indexing such as • retrieve any segment of K ≤ N consecutive symbols from the Burrows-Wheeler transform of T, which is at the heart of the bzip2 family of text compressors, and • retrieve any chunk of K ≤ N consecutive entries of the Suffix Array or the Suffix Tree, two popular Text Indexing data structures for T. Prior literature would take O(N logN) comparisons (and time) to solve these problems by solving the total problem of building the entire Burrows-Wheeler transform or Text Index for T, and performing a post-processing to single out the wanted portion. The technical challenge is that the suffixes of interest are potentially of sizeO(KN) and overlap in intricate ways: we have to use structural properties of these overlaps to avoid rescanning them repeatedly. We introduce a novel adaptive approach to partial computational problems above, and solve both the partial problems in O(K logK + N)
It is shown how to compute the lexicographically maximum suffix of a string of n ≥ 2 characters over a totally ordered alphabet using at most (4/3)n − 5/3 three-way character comparisons. The best previous bound, which has stood unchallenged for more than 25 years, is (3/2)n − O(1) comparisons. We also prove an interesting property of an algorithm for computing the maximum suffix both with respect to a total order < and with respect to its inverse order >.
Given string $S[1..N]$ and integer $k$, the {\em suffix selection} problem is to determine the $k$th lexicographically smallest amongst the suffixes $S[i\ldots N]$, $1 \leq i \leq N$. We study the suffix selection problem in the cache-aware model that captures two-level memory inherent in computing systems, for a \emph{cache} of limited size $M$ and block size $B$. The complexity of interest is the number of block transfers. We present an optimal suffix selection algorithm in the cache-aware model, requiring $\Theta\left(N/B\right)$ block transfers, for any string $S$ over an unbounded alphabet (where characters can only be compared), under the common tall-cache assumption (i.e. $M=\Omega\left(B^{1+\epsilon}\right)$, where $\epsilon<1$). Our algorithm beats the bottleneck bound for permuting an input array to the desired output array, which holds for nearly any nontrivial problem in hierarchical memory models.
In the 0/1-sorting problem, given a sequence S of elements drawn from a universe E and a characteristic function f : E ! {0,1}, the task is to rearrange the elements in S so that every element x, for which f(x) = 0, is placed before any element y, for which f(y) = 1. Moreover, this reordering should be done stably without altering the relative order of elements having the same f-value, and space efficientlyusing only O(1) words of extra space. In this paper we present a generic algorithm for solving the 0/1-sorting problem which works optimally for many different kinds of sequences and characteristic functions. The model of computation used is a word RAM with a two-level memory hierarchy consisting of an ideal cache and an arbitrarily large main memory. The performance of our algorithm can be summarized as follows: 1. Let n denote the length of S. The algorithm performs at most O(n) element exchanges, invocations of f, and word operations.
It is well known that n integers in the range [1,n c ] can be sorted in O(n) time in the RAM model using radix sorting. More generally, integers in any range [1,U] can be sorted in O(n√(loglog n)) time [5]. However, these algorithms use O(n) words of extra memory. Is this necessary? We present a simple, stable, integer sorting algorithm for words of size O(logn), which works in O(n) time and uses only O(1) words of extra memory on a RAM model. This is the integer sorting case most useful in practice. We extend this result with same bounds to the case when the keys are read-only, which is of theoretical interest. Another interesting question is the case of arbitrary c. Here we present a black-box transformation from any RAM sorting algorithm to a sorting algorithm which uses only O(1) extra space and has the same running time. This settles the complexity of in-place sorting in terms of the complexity of sorting.
Given a string S[1·s n], the suffix selection problemis to find the kth lexicographically smallest amongst the n suffixes S[i·s n], for i=1,...,n. In particular, the fundamental question is if selection can be performed more efficiently than sorting all the suffixes. If one considered n numbers, they can be sorted using Θ(n log n) comparisonsand the classical result from 70's is that selection can be done using O(n) comparisons. Thus selection is provably more efficient than sorting, for n numbers. Suffix sorting can be done using Θ(n log n) comparisons, but does suffix selection need suffix sorting? We settle this fundamental problem by presenting an optimal, deterministic algorithm for suffix selection using O(n) comparisons.
Given string T = T [1,..., n ], the suffix sorting problem is to lexicographically sort the suffixes T [ i,..., n ] for all i . This problem is central to the construction of suffix arrays and trees with many applications in string processing, computational biology and compression. A bottleneck in these applications is the amount of workspace needed to perform suffix sorting beyond the space needed to store the input as well as the output. In particular, emphasis is even on the constant c in the O(n) = cn space algorithms known for this problem. Currently the best previous result [5] takes O ( nv + n log n ) time and O ( n /√ v ) extra space, for any v ∈ [1,√ n ] for strings from a general alphabet. We improve this and present the first known in-place suffix sorting algorithm. Our algorithm takes O ( n log n ) time using O (1) workspace and is optimal in the worst case for the general alphabet.
In the comparison model the only operations allowed on input elements are comparisons and moves to empty cells of memory. We prove the existence of an algorithm that, for any set of s ≤n sorted sequences containing a total of n elements, computes the whole sorted sequence using O(nlogs) comparisons, O(n) data moves and O(1) auxiliary cells of memory besides the ones necessary for the n input elements. The best known algorithms with these same bounds are limited to the particular case s= O(1). From a more intuitive point of view, our result shows that it is possible to pass from merging to sorting in a seamless fashion, without losing the optimality with respect to any of the three main complexity measures of the comparison model. Our main statement has an implication in the field of adaptive sorting algorithms and improves [Franceschini and Geffert, Journal of the ACM, 52], showing that it is possible to exploit some form of pre-sortedness to lower the number of comparisons while still maintaining the optimality for space and data moves. More precisely, let us denote with OptM(X) the cost for sorting a sequence X with an algorithm that is optimal with respect to a pre-sortedness measure M. To the best of our knowledge, so far, for any pre-sortedness measure M, no full-optimal adaptive sorting algorithms were known (see [Estivill-Castro and Wood, ACM Comp. Surveys, 24], page 472). The best that could be obtained were algorithms sorting a sequence X using O(1) space, O(OptM(X)) comparisons and O(OptM(X)) moves. Hence, the move complexity seemed bound to be a function of M(X) (as for the comparison complexity). We prove that there exists a pre-sortedness measure for which that is false: the pre-sortedness measure Runs, defined as the number of ascending contiguous subsequences in a sequence. That follows directly from our main statement, since ${Opt}_{M}(X)=O(\left\vert{X}\right\vert \log Runs(X))$
The implicit dictionary problem is that of maintaining a dynamic ordered set, S, under the operations search, insert and delete, so that the elements of S are stored in the first |S| locations of an array. No operations are permitted on the data other than comparisons (≤) and interchanges. The only auxiliary memory permitted is a constant number of O(log |S|) bit integers. The organization will, then, rely heavily on the permutations of the relative order of the values in which the data is stored. While such a structure can be maintained in O(log |S|) time, the most interesting lower bound on the topic is that of Borodin, Fich, Meyer auf der Heide, Upfal and Wigderson [3]. They proved a tradeoff between search and update time in implicit dictionaries: if the update cost (comparisons and exchanges) is O(1), then the search cost must be Ω(|S|ε), for some constant ε > 0. The authors left open the question of whether such a tradeoff would hold if only the modifications performed during an update were considered. They conjectured that any implicit dictionary performing only O(1) exchanges per update should very quickly become "disorganized", and so require Ω(|S|ε) comparisons per search. We answer this long-standing open question by disproving the conjecture.
Dense trees are undirected graphs defined as natural extensions of trees. They are already known in the realm of graph coloring under the name of k-degenerate graphs. For a given integer k >= 1, a k-dense cycle is a connected graph, where the degree of each vertex is greater than k. A k-dense forest F = (V, E) is a graph without k-dense cycles as subgraphs. If F is connected, then is a k-dense tree. 1-dense trees are standard trees. We have vertical bar E vertical bar <= k vertical bar V vertical bar - k(k + 1)/2. If equality holds F is connected and is called a maximal k-dense tree. k-trees (a subfamily of triangulated graphs) are special cases of maximal k-dense trees.We review the basic theory of dense trees in the family of graphs and show their relation with k-trees. Vertex and edge connectivity is thoroughly investigated, and the role of maximal k-dense trees as "reinforced" spanning trees of arbitrary graphs is presented. Then it is shown how a k-dense forest or tree can be decomposed into a set of standard spanning trees connected through a common "root" of k vertices. All sections include efficient construction algorithms. Applications of k-dense trees in the fields of distributed systems and data structures are finally indicated. (C) 2005 Elsevier B.V. All rights reserved.
We settle a long-standing open question, namely whether it is possible to sort a sequence of n elements stably (i.e., preserving the original relative order of the equal elements), using O(1) auxiliary space and performing O(n log n) comparisons and O(n) data moves. Munro and Raman stated this problem in J. Algorithms (13, 1992) and gave an in-place but unstable sorting algorithm that performs O(n) data moves and O(n 1+ε ) comparisons. Subsequently (Algorithmica, 16, 1996) they presented a stable algorithm with these same bounds. Recently, Franceschini and Geffert (FOCS 2003) presented an unstable sorting algorithm that matches the asymptotic lower bounds on all computational resources.
We study three comparison-based problems related to multisets in the cache-oblivious model: Duplicate elimination, multisorting and finding the most frequent element (the mode). We are interested in minimizing the cache complexity (or number of cache misses) of algorithms for these problems in the context under which cache size and block size are unknown. We give algorithms with cache complexities within a constant factor of the optimal for all the problems. In the case of determining the mode, the optimal algorithm is randomized as the deterministic algorithm differs from the lower bound by a sublogarithmic factor. We can achieve optimality either with a randomized method or if given, along with the input, lg lg of relative frequency of the mode with a constant additive error.
We study the problem of determining the complexity of optimal comparison-based in-place sorting when the key length, k, is not a constant. We present the first algorithm for lexicographically sorting n keys in O(nk + n log n) time using O(1) auxiliary data locations, which is simultaneously optimal in time and space.
An array of n distinct keys can be sorted for logarithmic searching or can be organized as a heap for logarithmic updating, but it is unclear how to attain logarithmic time for both searching and updating. This natural question dates back to the heap of Williams and Floyd in the sixties and relates to the fundamental issue whether additional space besides those for the keys gives more computational power in dictionaries and how data ordering helps. Implicit data structures were introduced in the eighties with this goal, providing the best bound of O(log 2 n) time, until a recent result showing O(log 2 n/log log n) time. In this paper we describe the flat implicit tree, which is the first data structure obtaining O(log n) time for search and (amortized) update using an array of n cells.
We present the first in-place algorithm for sorting an array of size ) element transports.This solves a long-standing open problem, stated explicitly, for example, in Munro and Raman [1992], of whether there exists a sorting algorithm that matches the asymptotic lower bounds on all computational resources simultaneously.
Page 1. http://www.elsevier.com/locate/jcss Journal of Computer and System Sciences 68 (2004) 862 Author Index for Volume 68 A Achlioptas, Dimitris, 238 Ambainis, Andris, 398 Anceaume, E., 123 Anderson, James H., 157 B Bar-Yossef, Ziv, 702 Beame, Paul, 238 Becchetti, Luca, 80 Bshouty, Nader H., 205 C Charikar, Moses, 417 Chazelle, Bernard, 269 Chen, Bing-Chang, 598 Choi, Kwok Pui, 22 Cohen, Edith, 701 D de Alfaro, Luca, 374 Downey, Rod G., 96 Drewes, Frank, 611 Dunagan, John, 335 $Duri$s, Pavol, 675 E Engelfriet, Joost, 611 F Feldman, Jon, 733 Fern!andez, A., 123 Fischer, Eldar, 753 Franceschini, Gianni, 788 G Goemans, Michel X., 442 Grandjean, Etienne, 546 Grohe, Martin, 285 Grossi, Roberto, 788 Guruswami, Venkatesan, 701 H Hirschfeldt, Denis R., 96 Homan, Christopher M., 657 Hromkovi$c, Juraj, 675 I Inoue, Katsushi, 675 J Jackson, Jeffrey C., 205 Jayram, TS, 702 …
An implicit data structure for the dictionary problem maintains n data values in the first n locations of an array in such a way that it efficiently supports the operations insert, delete and search. No information other than that in O(1) memory cells and in the input data is to be retained; and the only operations performed on the data values (other than reads and writes) are comparisons. This paper describes the implicit B-tree, a new data structure supporting these operations in O(logBn) block transfers like in regular B-trees, under the realistic assumption that a block stores B=Ω(logn) keys, so that reporting r consecutive keys in sorted order has a cost of O(logBn+r/B) block transfers. En route a number of space efficient techniques for handling segments of a large array in a memory hierarchy are developed. Being implicit, the proposed data structure occupies exactly ⌈n/B⌉ blocks of memory after each update, where n is the number of keys after each update and B is the number of keys contained in a memory block. In main memory, the time complexity of the operations is O(log2n/loglogn), disproving a conjecture of the mid 1980s.