Solving the String Statistics Problem in Time O(nlog n)

Gerth Stølting Brodal, Rune Bang Lyngsø, Anna Östlin, and Christian Nørgaard Storm Pedersen

Technical Report, BRICS-RS-02-13, BRICS, Department of Computer Science, Aarhus University, 28 pages, October 2002.


The string statistics problem consists of preprocessing a string of length n such that given a query pattern of length m, the maximum number of non-overlapping occurrences of the query pattern in the string can be reported efficiently. Apostolico and Preparata introduced the minimal augmented suffix tree (MAST) as a data structure for the string statistics problem, and showed how to construct the MAST in time O(nlog2 n) and how it supports queries in time O(m) for constant sized alphabets. A subsequent theorem by Fraenkel and Simpson stating that a string has at most a linear number of distinct squares implies that the MAST requires space O(n). In this paper we improve the construction time for the MAST to O(nlog n) by extending the algorithm of Apostolico and Preparata to exploit properties of efficient joining and splitting of search trees together with a refined analysis.

Copyright notice

Copyright © 2002, BRICS, Department of Computer Science, Aarhus University. All rights reserved.

Online version

brics-rs-02-13.pdf (247 Kb)

BIBTEX entry

  author = "Gerth St{\o}lting Brodal and Rune Bang Lyngs{\o} and Anna \"Ostlin and Christian N{\o}rgaard Storm Pedersen",
  institution = "BRICS, Department of Computer Science, Aarhus University",
  issn = "0909-0878",
  month = "October",
  number = "BRICS-RS-02-13",
  pages = "28",
  title = "Solving the String Statistics Problem in Time $O(n\log n)$",
  year = "2002"