Compact q-gram Profiling of Compressed Strings

Philip Bille, Patrick Hagge Cording, Inge Li Gørtz

Research output: Chapter in Book/Report/Conference proceedingArticle in proceedingsResearchpeer-review

278 Downloads (Pure)


We consider the problem of computing the q-gram profile of a string T of size N compressed by a context-free grammar with n production rules. We present an algorithm that runs in O(N − α) expected time and uses O(n + k T , q ) space, where N − α ≤ qn is the exact number of characters decompressed by the algorithm and k T , q  ≤ N − α is the number of distinct q-grams in T . This simultaneously matches the current best known time bound and improves the best known space bound. Our space bound is asymptotically optimal in the sense that any algorithm storing the grammar and the q-gram profile must use Ω(n + k T , q ) space. To achieve this we introduce the q-gram graph that space-efficiently captures the structure of a string with respect to its q-grams, and show how to construct it from a grammar.
Original languageEnglish
Title of host publicationCombinatorial Pattern Matching : 24th Annual Symposium, CPM 2013, Bad Herrenalb, Germany, June 17-19, 2013. Proceedings
Publication date2013
ISBN (Print)978-3-642-38904-7
ISBN (Electronic)978-3-642-38905-4
Publication statusPublished - 2013
Event24th Annual Symposium on Combinatorial Pattern Matching (CPM 2013) - Bad Herrenalb, Germany
Duration: 17 Jun 201319 Jun 2013


Conference24th Annual Symposium on Combinatorial Pattern Matching (CPM 2013)
CityBad Herrenalb
Internet address
SeriesLecture Notes in Computer Science


Dive into the research topics of 'Compact q-gram Profiling of Compressed Strings'. Together they form a unique fingerprint.

Cite this