4 research outputs found

    Wavelet Trees Meet Suffix Trees

    Full text link
    We present an improved wavelet tree construction algorithm and discuss its applications to a number of rank/select problems for integer keys and strings. Given a string of length n over an alphabet of size σn\sigma\leq n, our method builds the wavelet tree in O(nlogσ/logn)O(n \log \sigma/ \sqrt{\log{n}}) time, improving upon the state-of-the-art algorithm by a factor of logn\sqrt{\log n}. As a consequence, given an array of n integers we can construct in O(nlogn)O(n \sqrt{\log n}) time a data structure consisting of O(n)O(n) machine words and capable of answering rank/select queries for the subranges of the array in O(logn/loglogn)O(\log n / \log \log n) time. This is a loglogn\log \log n-factor improvement in query time compared to Chan and P\u{a}tra\c{s}cu and a logn\sqrt{\log n}-factor improvement in construction time compared to Brodal et al. Next, we switch to stringological context and propose a novel notion of wavelet suffix trees. For a string w of length n, this data structure occupies O(n)O(n) words, takes O(nlogn)O(n \sqrt{\log n}) time to construct, and simultaneously captures the combinatorial structure of substrings of w while enabling efficient top-down traversal and binary search. In particular, with a wavelet suffix tree we are able to answer in O(logx)O(\log |x|) time the following two natural analogues of rank/select queries for suffixes of substrings: for substrings x and y of w count the number of suffixes of x that are lexicographically smaller than y, and for a substring x of w and an integer k, find the k-th lexicographically smallest suffix of x. We further show that wavelet suffix trees allow to compute a run-length-encoded Burrows-Wheeler transform of a substring x of w in O(slogx)O(s \log |x|) time, where s denotes the length of the resulting run-length encoding. This answers a question by Cormode and Muthukrishnan, who considered an analogous problem for Lempel-Ziv compression.Comment: 33 pages, 5 figures; preliminary version published at SODA 201

    Wavelet Trees Meet Suffix Trees

    No full text
    We present an improved wavelet tree construction algorithm and discuss its applications to a number of rank/select problems for integer keys and strings. Given a string of length n over an alphabet of size σn\sigma\leq n, our method builds the wavelet tree in O(nlogσ/logn)O(n \log \sigma/ \sqrt{\log{n}}) time, improving upon the state-of-the-art algorithm by a factor of logn\sqrt{\log n}. As a consequence, given an array of n integers we can construct in O(nlogn)O(n \sqrt{\log n}) time a data structure consisting of O(n)O(n) machine words and capable of answering rank/select queries for the subranges of the array in O(logn/loglogn)O(\log n / \log \log n) time. This is a loglogn\log \log n-factor improvement in query time compared to Chan and P\u{a}tra\c{s}cu and a logn\sqrt{\log n}-factor improvement in construction time compared to Brodal et al. Next, we switch to stringological context and propose a novel notion of wavelet suffix trees. For a string w of length n, this data structure occupies O(n)O(n) words, takes O(nlogn)O(n \sqrt{\log n}) time to construct, and simultaneously captures the combinatorial structure of substrings of w while enabling efficient top-down traversal and binary search. In particular, with a wavelet suffix tree we are able to answer in O(logx)O(\log |x|) time the following two natural analogues of rank/select queries for suffixes of substrings: for substrings x and y of w count the number of suffixes of x that are lexicographically smaller than y, and for a substring x of w and an integer k, find the k-th lexicographically smallest suffix of x. We further show that wavelet suffix trees allow to compute a run-length-encoded Burrows-Wheeler transform of a substring x of w in O(slogx)O(s \log |x|) time, where s denotes the length of the resulting run-length encoding. This answers a question by Cormode and Muthukrishnan, who considered an analogous problem for Lempel-Ziv compression

    Efektywne struktury danych dla zapytań wewnętrznych w tekstach

    No full text
    Rozprawa dotyczy zapytań wewnętrznych w tekstach, czyli rozwiązywania klasycznych problemów algorytmiki tekstów dla podsłów danego słowa. Formalnie, zadanie polega na wstępnym przetworzeniu statycznego słowa T długości n (tekstu), tak aby skonstruować strukturę danych odpowiadającą na pewne pytania dotyczące jego podsłów. Podsłowa te są identyfikowane w stałej pamięci za pomocą wystąpień w T, zwanych fragmentami tekstu i reprezentowanych przez pozycje początkową oraz końcową. Komponenty dla zapytań wewnętrznych są używane w wielu algorytmach tekstowych i wchodzą w skład bardziej rozbudowanych struktur danych. Zapytania o długość najdłuższego wspólnego prefiksu dwóch podsłów tekstu T stanowią zdecydowanie najpowszechniejszy problem tego rodzaju. Używa się ich między innymi do sprawdzania, czy dwa fragmenty pasują do siebie (reprezentują to samo słowo), i do porównywania podsłów w porządku leksykograficznym. Mnogość zastosowań wynika z istnienia optymalnego rozwiązania w standardowym modelu tekstów (nad alfabetem złożonym z liczb naturalnych wielkości wielomianowej ze względu na n), czyli struktury danych wielkości O(n), która odpowiada na zapytania w czasie O(1) i posiada procedurę konstrukcji w czasie O(n). W rozprawie przedstawiamy pierwszą optymalną strukturę danych dla małych alfabetów rozmiaru σ n: strukturę wielkości O(n/ logσ n) charakteryzującą się czasem zapytania O(1) i czasem konstrukcji O(n/ logσ n) (na podstawie spakowanej reprezentacji tekstu, gdzie każda komórka pamięci zawiera Θ(logσ n) symboli). W dalszej części rozprawy wracamy do tekstów nad alfabetem wielkości wielomianowej ze względu na n i skupiamy się na bardziej złożonych zapytaniach wewnętrznych. Nasza pierwsza struktura danych rozwiązuje problem wewnętrznego wyszukiwania wzorca, czyli zapytań o wystąpienia jednego podsłowa x w obrębie drugiego podsłowa y. Po przetworzeniu tekstu T w czasie O(n), odpowiada ona na takie zapytania w czasie proporcjonalnym do ilorazu |y|/|x| długości podsłów, który jest wymagany ze względu na pesymistyczną złożoność informacji zawartej w wyniku. Tej samej struktury danych używamy także do zapytań o wszystkie okresy wskazanego podsłowa; uzyskany tutaj czas logarytmiczny również jest optymalny. Kolejne struktury danych stworzone zostały do obsługi zapytań o najmniejszy leksykograficznie sufiks i najmniejszą leksykograficznie rotację cykliczną wskazanego podsłowa. Odpowiadamy na nie w czasie O(1) po przetworzeniu tekstu w czasie O(n). Rozważamy także bardziej ogólne pytania o k-ty leksykograficznie sufiks podsłowa (czyli o k-ty elementy tablicy sufiksowej podsłowa) oraz o leksykograficzną rangę wskazanego sufiksu podsłowa (czyli element odwrotnej tablicy sufiksowej). Nasza struktura danych przetwarza zapytania obydwu rodzajów w czasie O(log n), zajmuje O(n) komórek pamięci i można ją zbudować w czasie O(n √ log n). Stworzone w rozprawie narzędzia dają także lepsze od znanych dotychczas rozwiązania problemu kompresji podsłów, czyli zapytań o reprezentację podsłowa według ustalonego algorytmu kompresji; rozważamy w tym kontekście metody oparte na parsowaniu Lempela-Ziva i transformacie Burrowsa-Wheelera. Rezultaty rozprawy łączą narzędzia do przetwarzania tekstów z kombinatoryką słów i najnowszymi osiągnięciami w dziedzinie abstrakcyjnych struktur danych. Naszą kluczową technikę stanowi innowacyjna metoda lokalnie zgodnego łamania symetrii między pozycjami tekstu, która stoi za nowymi rozwiązaniami dla zapytań o długość najdłuższego wspólnego prefiksu i dla wewnętrznego wyszukiwania wzorca.This thesis is devoted to internal queries in texts, which ask to solve classic text-processing problems for substrings of a given text. More precisely, the task is to preprocess a static string T of length n (called the text) and construct a data structure answering certain questions about the substrings of T. The substrings involved in each query are specified in constant space by their occurrences in T, called fragments of T, identified by the start and the end positions. Components for internal queries often become parts of more complex data structures, and they are used in many algorithms for text processing. Longest Common Extension Queries, asking for the length of the longest common prefix of two substrings of the text T, are by far the most popular internal queries. They are used for checking if two fragments match (represent the same string) and for lexicographic comparison of substrings. Due to an optimal solution in the standard setting of texts over polynomially-bounded integer alphabets, with O(1)-time queries, O(n) size, and O(n) construction time, they have found numerous applications across stringology. In this dissertation, we provide the first optimal data structure for smaller alphabets of size σ n: it handles queries in O(1) time, takes O(n/ logσ n) space, and admits an O(n/ logσ n)-time construction (from the packed representation of T with Θ(logσ n) characters in each machine word). We then go back to alphabets of size σ polynomial in n and focus on more complex internal queries. Our first data structure supports Internal Pattern Matching Queries, which ask for the occurrences of one substring x within another substring y. After O(n)-time preprocessing of the text T, it answers these queries in time proportional to the quotient |y|/|x| of substrings’ lengths, which is required due to the information content of the output. We also use this data structure for Period Queries, asking for the periods of a given substring. Here, our logarithmic query time is also optimal by a similar information-theoretic argument. Further data structures are designed for Minimal Suffix and Minimal Rotation Queries, asking to compute the lexicographically smallest non-empty suffix and cyclic rotation of a given substring, respectively. They are answered in O(1) time after O(n)-time preprocessing. We also consider a more general problem of simulating the suffix array of a given substring (Substring Suffix Selection Queries, asking for the kth lexicographically smallest suffix of a substring) and its inverse suffix array (Substring Suffix Rank Queries, asking for the lexicographic rank of a substring’s suffix). Our data structure supports these queries in O(log n) time, takes O(n) space, and can be constructed in O(n √ log n) time. The tools developed in this dissertation additionally yield improved results for several kinds of Substring Compression Queries, which ask for the compressed representation of a given substring obtained using a specific method; we consider schemes based on the Lempel–Ziv parsing and the Burrows–Wheeler transform. Our results combine text-processing tools with combinatorics on words and state-of-the-art general-purpose data structures. The key technical contribution is a novel locally consistent symmetry-breaking scheme, formalized in terms of synchronizing functions, which is central to our solutions for Longest Common Extension Queries and Internal Pattern Matching Queries
    corecore