Skip to main content

A Simple Optimal Representation for Balanced Parentheses

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 3109))

Abstract

We consider succinct, or highly space-efficient, representations of a (static) string consisting of n pairs of balanced parentheses, that support natural operations such as finding the matching parenthesis for a given parenthesis, or finding the pair of parentheses that most tightly enclose a given pair. This problem was considered by Jacobson, [Proc. 30th FOCS, 549–554, 1989] and Munro and Raman, [SIAM J. Comput. 31 (2001), 762–776], who gave O(n)-bit and 2n + o(n)-bit representations, respectively, that supported the above operations in O(1) time on the RAM model of computation. This data structure is a fundamental tool in succinct representations, and has applications in representing suffix trees, ordinal trees, planar graphs and permutations.

We consider the practical performance of parenthesis representations. First, we give a new 2n + o(n)-bit representation that supports all the above operations in O(1) time. This representation is conceptually simpler, its space bound has a smaller o(n) term and it also has a simple and uniform o(n) time and space construction algorithm. We implement our data structure and Jacobson’s, and evaluate their practical performance (speed and memory usage), when used in a succinct representation of large static XML documents. As a baseline, we compare our representations against a widely-used implementation of the standard DOM (Document Object Model) representation of XML documents. Both succinct representations use orders of magnitude less space than DOM, but are slightly slower and provide less functionality.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Benoit, D., Demaine, E.D., Munro, J.I.J., Raman, V.: Representing trees of higher degree. In: Dehne, F., Gupta, A., Sack, J.-R., Tamassia, R. (eds.) WADS 1999. LNCS, vol. 1663, pp. 169–180. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  2. Benoit, D.A., Demaine, E.D., Munro, J.I., Raman, R., Raman, V., Rao, S.S.: Representing trees of higher degree. TR 2001/46, Dept. of Maths & CS, University of Leicester (2001)

    Google Scholar 

  3. Centerpoint XML.: http://www.cpointc.com/XML

  4. Cheney, J.: Compressing XML with multiplexed hierarchical PPM models. In: Proc. Data Compression Conference (DCC 2001), pp. 163–172. IEEE Computer Society, Los Alamitos (2001)

    Chapter  Google Scholar 

  5. Chupa, K.: MMath Thesis, University of Waterloo (1997)

    Google Scholar 

  6. Clark, D., Munro, J.I.: Efficient suffix trees on secondary storage. In: Proc. 7th ACM-SIAM SODA, pp. 383–391 (1996)

    Google Scholar 

  7. Darragh, J.J., Cleary, J.G., Witten, I.H.: Bonsai: a compact representation of trees. Software-Practice and Experience 23, 277–291 (1993)

    Article  Google Scholar 

  8. Le Hors, P., Le Hégaret, L., Wood, G., Nicol, J., Robie, M., Champion, S.: Byrne. Document Object Model (DOM) Level 2 Core Specification Version 1.0. W3C Recommendation November 13 (2000), http://www.w3.org/TR/DOM-Level-2-Core W3C Consortium (2000)

  9. Ferragina, P., Manzini, G.: An experimental study of a compressed index. Information Sciences 135, 13–28 (2001)

    Article  MATH  Google Scholar 

  10. Fredman, M.L., Komlós, J., Szemerédi, E.: Storing a sparse table with O(1) worst case access time. J. ACM 31, 538–544 (1984)

    Article  MATH  Google Scholar 

  11. Geary, R.F., Raman, R., Raman, V.: Succinct ordinal trees with level-ancestor queries. In: Proc. 15th ACM-SIAM SODA, pp. 1–10 (2004)

    Google Scholar 

  12. Grossi, R., Gupta, A., Vitter, J.S.: When indexing equals compression: Experiments on suffix arrays and trees. In: Proc. 15th ACM-SIAM SODA, pp. 629–638 (2004)

    Google Scholar 

  13. Hagerup, T., Miltersen, P.B., Pagh, R.: deterministic dictionaries. Journal of Algorithms 41(1), 69–85 (2001)

    Article  MATH  MathSciNet  Google Scholar 

  14. Jacobson, G.: Space-efficient static trees and graphs. In: Proc. 30th FOCS, pp. 549–554 (1989)

    Google Scholar 

  15. Munro, J.I.: Tables. In: Chandru, V., Vinay, V. (eds.) FSTTCS 1996. LNCS, vol. 1180, pp. 37–42. Springer, Heidelberg (1996)

    Google Scholar 

  16. Munro, J.I., Raman, V.: Succinct representation of balanced parentheses and static trees. SIAM J. Computing 31, 762–776 (2001)

    Article  MATH  MathSciNet  Google Scholar 

  17. Munro, I., Raman, R., Raman, V., Rao, S.S.: Succinct representation of Permutations. In: Baeten, J.C.M., Lenstra, J.K., Parrow, J., Woeginger, G.J. (eds.) ICALP 2003. LNCS, vol. 2719, pp. 345–356. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  18. Munro, I., Raman, V., Rao, S.S.: Space Efficient Suffix Trees. J. of Algorithms 39, 205–222 (2001)

    Article  MATH  MathSciNet  Google Scholar 

  19. Raman, R., Raman, V., Rao, S.S.: Succinct indexable dictionaries with applications to encoding k-ary trees and multisets. In: Proc. 13th ACM-SIAM SODA, pp. 233–242 (2002)

    Google Scholar 

  20. Sadakane, K.: Succinct representations of lcp information and improvements in the compressed suffix arrays. In: Proc. 13th ACM-SIAM SODA, pp. 225–232 (2002)

    Google Scholar 

  21. UW XML Repository, http://www.cs.washington.edu/research/xmldatasets/

  22. http://cdsweb.u-strasbg.fr/doc/VOTable/

  23. http://xml.apache.org/xindice/FAQ

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2004 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Geary, R.F., Rahman, N., Raman, R., Raman, V. (2004). A Simple Optimal Representation for Balanced Parentheses. In: Sahinalp, S.C., Muthukrishnan, S., Dogrusoz, U. (eds) Combinatorial Pattern Matching. CPM 2004. Lecture Notes in Computer Science, vol 3109. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-27801-6_12

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-27801-6_12

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-22341-2

  • Online ISBN: 978-3-540-27801-6

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics