Skip to main content

In-Place Binary Counters

  • Conference paper
Mathematical Foundations of Computer Science 2013 (MFCS 2013)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 8087))

Abstract

We introduce a binary counter that supports increments and decrements in O(1) worst-case time per operation. (We assume that arithmetic operations on an index variable that is stored in one computer word can be performed in O(1) time each.) To represent any integer in the range from 0 to 2n − 1, our counter uses an array of at most n bits plus few words of \(\lceil \lg (1 + n) \rceil\) bits each. Extended-regular and strictly-regular counters are known to also support increments and decrements in O(1) worst-case time per operation, but the implementation of these counters would require O(n) words of extra space, whereas our counter only needs O(1) words of extra space. Compared to other space-efficient counters, which rely on Gray codes, our counter utilizes codes with binary weights allowing for its usage in the construction of efficient data structures.

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 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

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Bose, P., Carmi, P., Jansens, D., Maheshwari, A., Morin, P., Smid, M.: Improved methods for generating quasi-gray codes. In: Kaplan, H. (ed.) SWAT 2010. LNCS, vol. 6139, pp. 224–235. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  2. Brodal, G.S., Greve, M., Pandey, V., Rao, S.S.: Integer representations towards efficient counting in the bit probe model. In: Ogihara, M., Tarui, J. (eds.) TAMC 2011. LNCS, vol. 6648, pp. 206–217. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  3. Clancy, M.J., Knuth, D.E.: A programming and problem-solving seminar. Technical Report STAN-CS-77-606, Computer Science Department, Stanford University, Stanford (1977)

    Google Scholar 

  4. Demaine, E., et al.: Advanced data structures: Lecture 17 (2012), http://courses.csail.mit.edu/6.851/spring12/scribe/L17.pdf

  5. Driscoll, J.R., Gabow, H.N., Shrairman, R., Tarjan, R.E.: Relaxed heaps: An alternative to Fibonacci heaps with applications to parallel computation. Commun. ACM 31(11), 1343–1354 (1988)

    Article  MathSciNet  Google Scholar 

  6. Elmasry, A., Jensen, C., Katajainen, J.: Multipartite priority queues. ACM Trans. Algorithms 5(1), Acticle 14 (2008)

    Google Scholar 

  7. Elmasry, A., Jensen, C., Katajainen, J.: Two new methods for constructing double-ended priority queues from priority queues. Computing 83(4), 193–204 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  8. Elmasry, A., Jensen, C., Katajainen, J.: Two-tier relaxed heaps. Acta Inform. 45(3), 193–210 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  9. Elmasry, A., Jensen, C., Katajainen, J.: Strictly-regular number system and data structures. In: Kaplan, H. (ed.) SWAT 2010. LNCS, vol. 6139, pp. 26–37. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  10. Elmasry, A., Katajainen, J.: Worst-case optimal priority queues via extended regular counters. In: Hirsch, E.A., Karhumäki, J., Lepistö, A., Prilutskii, M. (eds.) CSR 2012. LNCS, vol. 7353, pp. 125–137. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  11. Gray, F.: Pulse code communications. U.S. Patent 2632058 (1953)

    Google Scholar 

  12. Hagerup, T.: Sorting and searching on the word RAM. In: Morvan, M., Meinel, C., Krob, D. (eds.) STACS 1998. LNCS, vol. 1373, pp. 366–398. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  13. Kaplan, H., Shafrir, N., Tarjan, R.E.: Meldable heaps and Boolean union-find. In: STOC 2002, pp. 573–582. ACM, New York (2002)

    Google Scholar 

  14. Okasaki, C.: Purely Functional Data Structures. Cambridge University Press, Cambridge (1998)

    Book  Google Scholar 

  15. Preiss, B.R.: Data Structures and Algorithms with Object-Oriented Design Patterns in C++. John Wiley & Sons, Inc., New York (1999)

    Google Scholar 

  16. Rahman, M.Z., Munro, J.I.: Integer representation and counting in the bit probe model. Algorithmica 56(1), 105–127 (2010)

    Article  MathSciNet  MATH  Google Scholar 

  17. Vuillemin, J.: A data structure for manipulating priority queues. Commun. ACM 21(4), 309–315 (1978)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Elmasry, A., Katajainen, J. (2013). In-Place Binary Counters. In: Chatterjee, K., Sgall, J. (eds) Mathematical Foundations of Computer Science 2013. MFCS 2013. Lecture Notes in Computer Science, vol 8087. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-40313-2_32

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-40313-2_32

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-40312-5

  • Online ISBN: 978-3-642-40313-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics