Skip to main content

Rank and Select Operations on Binary Strings

1974; Elias

  • Reference work entry
Encyclopedia of Algorithms

Keywords and Synonyms

Binary bit-vector ; Compressed bit-vector, Rank and select dictionary; Fully indexable dictionary (FID)          

Problem Definition

Given a static sequence \( \boldsymbol{b} = b_1 \dots b_m \) of m bits, to preprocess the sequence and to create a space-efficient data structure that supports the following operations rapidly:

\( \mathsf{rank_1} (i) \) :

takes an index i as input, \( 1 \le i \le m \), and returns the number of 1s among \( b_1 \dots b_i \).

\( \mathsf{select_1} (i) \) :

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

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 what follows, |x| denotes the length of a bit sequence x and w(x...

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 399.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    For compressed bit-vectors, the ‘lower-order’ o(m) or o(n) term can dominate \( B(m,n) \), but this is not our concern here.

Recommended Reading

  1. Aho, A.V., Hopcroft, J.E., Ullman, J.D.: The Design and Analysis of Computer Algorithms. Addison-Wesley (1974)

    Google Scholar 

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

    Google Scholar 

  3. Delpratt, O., Rahman, N., Raman, R.: Engineering the LOUDS succinct tree representation. In: Proc. WEA 2006. LNCS, vol. 4007, pp. 134–145. Springer, Berlin (2006)

    Google Scholar 

  4. Delpratt, O., Rahman, N., Raman, R.: Compressed prefix sums. In: Proc. SOFSEM 2007. LNCS, vol. 4362, pp. 235–247 (2007)

    Google Scholar 

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

    Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

  7. Geary, R.F., Rahman, N., Raman, R., Raman, V.: A simple optimal representation for balanced parentheses. Theor. Comput. Sci. 368, 231–246 (2006)

    Article  MathSciNet  MATH  Google Scholar 

  8. Golynski, A.: Optimal lower bounds for rank and select indexes. In: Proc. ICALP 2006, Part I. LNCS, vol. 4051, pp. 370–381 (2006)

    Google Scholar 

  9. González, R., Navarro, G.: Statistical encoding of succinct data structures. In: Proc. CPM 2006. LNCS, vol. 4009, pp. 294–305. Springer, Berlin (2006)

    Google Scholar 

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

    Google Scholar 

  11. Kim, D.K., Na, J.C., Kim, J.E., Park, K.: Efficient implementation of Rank and Select functions for succinct representation. In: Proc. WEA 2005. LNCS, vol. 3505, pp. 315–327 (2005)

    Google Scholar 

  12. Munro, J.I., Srinivasa Rao, S.: Succinct representation of data structures. In: Mehta, D., Sahni, S. (eds.) Handbook of Data Structures with Applications, Chap 37. Chapman and Hall/CRC Press (2005)

    Google Scholar 

  13. Okanohara, D., Sadakane, K.: Practical entropy-compressed rank/select dictionary. In: Proc. 9th ACM-SIAM Workshop on Algorithm Engineering and Experiments (ALENEX '07), SIAM, to appear (2007)

    Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

  15. Patrascu, M., Thorup, M.: Time-space trade-offs for predecessor search. In: Proc. 38th ACM STOC, pp. 232–240 (2006)

    Google Scholar 

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

    Google Scholar 

  17. Sadakane, K., Grossi, R.: Squeezing succinct data structures into entropy bounds. In: Proc. 17th ACM-SIAM SODA, pp. 1230–1239. ACM Press (2006)

    Google Scholar 

  18. Witten, I., Moffat, A., Bell, I.: Managing Gigabytes, 2nd edn. Morgan Kaufmann (1999)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2008 Springer-Verlag

About this entry

Cite this entry

Rahman, N., Raman, R. (2008). Rank and Select Operations on Binary Strings. In: Kao, MY. (eds) Encyclopedia of Algorithms. Springer, Boston, MA. https://doi.org/10.1007/978-0-387-30162-4_332

Download citation

Publish with us

Policies and ethics