Skip to main content
Article thumbnail
Location of Repository

A Simple Optimal Representation for Balanced Parentheses.

By Richard F. Geary, Naila Rahman, Rajeev Raman and V. Raman


We consider succinct, or highly space-efficient, representations of a (static) string consisting of n pairs of balanced parentheses,\ud which support natural operations such as finding the matching parenthesis for a given parenthesis, or finding the pair of parentheses\ud that most tightly enclose a given pair. This problem was considered by Jacobson [Space-efficient static trees and graphs, in: Proc.\ud of the 30th FOCS, 1989, pp. 549–554] and Munro and Raman [Succinct representation of balanced parentheses and static trees,\ud SIAM J. Comput. 31 (2001) 762–776] who gave O(n)-bit and 2n + o(n)-bit representations, respectively, that supported the above\ud operations in O(1) time on the RAM model of computation. This data structure is a fundamental tool in succinct representations,\ud and has applications in representing suffix trees, ordinal trees, planar graphs and permutations.\ud We consider the practical performance of parenthesis representations. First, we give a new 2n + o(n)-bit representation that\ud supports all the above operations in O(1) time. This representation is conceptually simpler, its space bound has a smaller o(n) term\ud and it also has a simple and uniform o(n) time and space construction algorithm.\ud We implement our data structure and a variant of Jacobson’s, and evaluate their practical performance (speed and memory usage),\ud when used in a succinct representation of trees derived from XML documents. As a baseline, we compare our representations against\ud a widely used implementation of the standard DOM (document object model) representation of XML documents. Both succinct\ud representations use orders of magnitude less space than DOM and tree traversal operations are usually only slightly slower than in\ud DOM

Year: 2006
DOI identifier: 10.1016/j.tcs.2006.09.014
OAI identifier:
Download PDF:
Sorry, we are unable to provide the full text but you may find it at the following location(s):
  • (external link)
  • (external link)
  • Suggested articles

    To submit an update or takedown request for this paper, please submit an Update/Correction/Removal Request.