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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
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)
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)
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)
Demaine, E., et al.: Advanced data structures: Lecture 17 (2012), http://courses.csail.mit.edu/6.851/spring12/scribe/L17.pdf
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)
Elmasry, A., Jensen, C., Katajainen, J.: Multipartite priority queues. ACM Trans. Algorithms 5(1), Acticle 14 (2008)
Elmasry, A., Jensen, C., Katajainen, J.: Two new methods for constructing double-ended priority queues from priority queues. Computing 83(4), 193–204 (2008)
Elmasry, A., Jensen, C., Katajainen, J.: Two-tier relaxed heaps. Acta Inform. 45(3), 193–210 (2008)
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)
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)
Gray, F.: Pulse code communications. U.S. Patent 2632058 (1953)
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)
Kaplan, H., Shafrir, N., Tarjan, R.E.: Meldable heaps and Boolean union-find. In: STOC 2002, pp. 573–582. ACM, New York (2002)
Okasaki, C.: Purely Functional Data Structures. Cambridge University Press, Cambridge (1998)
Preiss, B.R.: Data Structures and Algorithms with Object-Oriented Design Patterns in C++. John Wiley & Sons, Inc., New York (1999)
Rahman, M.Z., Munro, J.I.: Integer representation and counting in the bit probe model. Algorithmica 56(1), 105–127 (2010)
Vuillemin, J.: A data structure for manipulating priority queues. Commun. ACM 21(4), 309–315 (1978)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)