Skip to main content

Rank and Select Operations on Bit Strings

  • Living reference work entry
  • First Online:
Encyclopedia of Algorithms

Years and Authors of Summarized Original Work

1974; Elias1989; Jacobson1998; Clark2007; Raman, Raman, Rao2008; PÇŽtraÅŸcu2014; Golynski, Orlandi, Raman, Rao

Problem Definition

Given a static bit string \(\boldsymbol{b} = b_{1}\ldots b_{m}\), the objective is to preprocess \(\boldsymbol{b}\) and to create a space-efficient data structure that supports the following operations rapidly:

rank 1 (i):

takes an index i as input, 1 ≤ i ≤ m, and returns the number of 1s among b 1 … b i .

select 1 (i):

takes an index i ≥ 1 as input and returns the position of the i-th 1 in \(\boldsymbol{b}\), and − 1 if i is greater than the number of 1s in \(\boldsymbol{b}\).

A data structure that supports the operations above will be called a bit vector. The operations rank 0 and select 0 are defined analogously for the 0s in \(\boldsymbol{b}\). As \(\mathsf{rank}_{0}(i) = i -\mathsf{rank}_{1}(i)\), one considers just rank 1 (abbreviated to rank) and refers to select 0 and select 1 collectively as select. In...

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

Access this chapter

Institutional subscriptions

Recommended Reading

  1. Arroyuelo D, Claude F, Maneth S, Mäkinen V, Navarro G, Nguyen K, Sirén J, Välimäki N (2015) Fast in-memory XPath search using compressed indexes. Softw Pract Exp 45(3):399–434.

    Article  Google Scholar 

  2. Clark DR (1998) Compact PAT trees. PhD thesis, University of Waterloo, Waterloo

    Google Scholar 

  3. Delpratt O, Rahman N, Raman R (2006) Engineering the LOUDS succinct tree representation. In: Àlvarez C, Serna MJ (eds) WEA. Lecture notes in computer science, vol 4007. Springer, Berlin/Heidelberg, pp 134–145.

    Google Scholar 

  4. Delpratt O, Raman R, Rahman N (2008) Engineering succinct DOM. In: Kemper A, Valduriez P, Mouaddib N, Teubner J, Bouzeghoub M, Markl V, Amsaleg L, Manolescu I (eds) EDBT. ACM international conference proceeding series, vol 261. ACM, New York, pp 49–60.

    Chapter  Google Scholar 

  5. Elias P (1974) Efficient storage and retrieval by content and address of static files. J ACM 21:246–260.

    Article  MATH  MathSciNet  Google Scholar 

  6. Ferragina P, Venturini R (2007) A simple storage scheme for strings achieving entropy bounds. Theor Comput Sci 372(1):115–121.

    Article  MATH  MathSciNet  Google Scholar 

  7. Ferragina P, Luccio F, Manzini G, Muthukrishnan S (2009) Compressing and indexing labeled trees, with applications. J ACM 57(1).

    Google Scholar 

  8. Gog S, Beller T, Moffat A, Petri M (2014) From theory to practice: plug and play with succinct data structures. In: Gudmundsson J, Katajainen J (eds) Experimental algorithms – 13th international symposium, SEA 2014, Copenhagen, 29 June–1 July 2014. Proceedings. Lecture notes in computer science, vol 8504. Springer, Heidelberg, pp 326–337.

    Google Scholar 

  9. Golynski A (2007) Optimal lower bounds for rank and select indexes. Theor Comput Sci 387(3):348–359.

    Article  MATH  MathSciNet  Google Scholar 

  10. Golynski A, Raman R, Rao SS (2008) On the redundancy of succinct data structures. In: Gudmundsson J (ed) SWAT. Lecture notes in computer science, vol 5124. Springer, Heidelberg, pp 148–159.

    Google Scholar 

  11. Golynski A, Orlandi A, Raman R, Rao SS (2014) Optimal indexes for sparse bit vectors. Algorithmica 69(4):906–924.

    Article  MATH  MathSciNet  Google Scholar 

  12. Grossi R, Ottaviano G (2013) Design of practical succinct data structures for large data collections. In: Bonifaci V, Demetrescu C, Marchetti-Spaccamela A (eds) Experimental algorithms, 12th international symposium, SEA 2013, Rome, 5–7 June 2013. Proceedings. Lecture notes in computer science, vol 7933. Springer, Heidelberg/New York, pp 5–17.

    Google Scholar 

  13. Hagerup T (1998) Sorting and searching on the word RAM. In: Morvan M, Meinel C, Krob D (eds) STACS 98, 15th annual symposium on theoretical aspects of computer science, Paris, 25–27 Feb 1998, Proceedings. Lecture notes in computer science, vol 1373. Springer, Berlin/New York, pp 366–398.

    Google Scholar 

  14. Jacobson G (1989) Succinct static data structures. PhD thesis, Carnegie Mellon University, Pittsburgh

    Google Scholar 

  15. Li H, Durbin R (2009) Fast and accurate short read alignment with Burrows-Wheeler transform. Bioinformatics 25(14):1754–1760

    Article  Google Scholar 

  16. Navarro G, Mäkinen V (2007) Compressed full-text indexes. ACM Comput Surv 39(1).

    Google Scholar 

  17. Pagh R (2001) Low redundancy in static dictionaries with constant query time. SIAM J Comput 31(2):353–363

    Article  MATH  MathSciNet  Google Scholar 

  18. Patrascu M (2008) Succincter. In: 49th annual IEEE symposium on foundations of computer science, FOCS 2008, Philadelphia, 25–28 Oct 2008. IEEE Computer Society, Los Alamitos, pp 305–313.

    Google Scholar 

  19. Patrascu M, Thorup M (2006) Time-space trade-offs for predecessor search. In: Kleinberg JM (ed) Proceedings of the 38th annual ACM symposium on theory of computing, Seattle, 21–23 May 2006, ACM, New York, pp 232–240.

    Google Scholar 

  20. Patrascu M, Viola E (2010) Cell-probe lower bounds for succinct partial sums. In: Charikar M (ed) Proceedings of the twenty-first annual ACM-SIAM symposium on discrete algorithms, SODA 2010, Austin, 17–19 Jan 2010. SIAM, Philadelphia, pp 117–122.

    Google Scholar 

  21. Raman R, Raman V, Satti SR (2007) Succinct indexable dictionaries with applications to encoding k-ary trees, prefix sums and multisets. ACM Trans Algorithms 3(4):Article 43, 25pp.

    Google Scholar 

  22. Tabei Y, Tsuda K (2011) Kernel-based similarity search in massive graph databases with wavelet trees. In: Proceedings of the eleventh SIAM international conference on data mining, SDM 2011, 28–30 Apr 2011, Mesa. SIAM/Omnipress, Philadelphia, pp 154–163,

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Rajeev Raman .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer Science+Business Media New York

About this entry

Cite this entry

Raman, R. (2015). Rank and Select Operations on Bit Strings. In: Kao, MY. (eds) Encyclopedia of Algorithms. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-27848-8_332-2

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-27848-8_332-2

  • Received:

  • Accepted:

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Online ISBN: 978-3-642-27848-8

  • eBook Packages: Springer Reference Computer SciencesReference Module Computer Science and Engineering

Publish with us

Policies and ethics