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
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
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)
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)
Centerpoint XML.: http://www.cpointc.com/XML
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)
Chupa, K.: MMath Thesis, University of Waterloo (1997)
Clark, D., Munro, J.I.: Efficient suffix trees on secondary storage. In: Proc. 7th ACM-SIAM SODA, pp. 383–391 (1996)
Darragh, J.J., Cleary, J.G., Witten, I.H.: Bonsai: a compact representation of trees. Software-Practice and Experience 23, 277–291 (1993)
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)
Ferragina, P., Manzini, G.: An experimental study of a compressed index. Information Sciences 135, 13–28 (2001)
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)
Geary, R.F., Raman, R., Raman, V.: Succinct ordinal trees with level-ancestor queries. In: Proc. 15th ACM-SIAM SODA, pp. 1–10 (2004)
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)
Hagerup, T., Miltersen, P.B., Pagh, R.: deterministic dictionaries. Journal of Algorithms 41(1), 69–85 (2001)
Jacobson, G.: Space-efficient static trees and graphs. In: Proc. 30th FOCS, pp. 549–554 (1989)
Munro, J.I.: Tables. In: Chandru, V., Vinay, V. (eds.) FSTTCS 1996. LNCS, vol. 1180, pp. 37–42. Springer, Heidelberg (1996)
Munro, J.I., Raman, V.: Succinct representation of balanced parentheses and static trees. SIAM J. Computing 31, 762–776 (2001)
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)
Munro, I., Raman, V., Rao, S.S.: Space Efficient Suffix Trees. J. of Algorithms 39, 205–222 (2001)
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)
Sadakane, K.: Succinct representations of lcp information and improvements in the compressed suffix arrays. In: Proc. 13th ACM-SIAM SODA, pp. 225–232 (2002)
UW XML Repository, http://www.cs.washington.edu/research/xmldatasets/
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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