Abstract
We examine the problem of integer representation in a nearly minimal number of bits so that the increment and the decrement (and indeed the addition and the subtraction) operations can be performed using few bit inspections and fewer bit changes. The model of computation we considered is the bit probe model, where the complexity measure counts only the bitwise accesses to the data structure. We present several efficient data structures to represent integer that use a logarithmic number of bit inspections and a constant number of bit changes per operation. The most space-efficient data structure uses only one extra bit. We also present an extension to our data structure to support efficient addition and subtraction, where the larger value is replaced by the result, while retaining the same asymptotic bounds for the increment and the decrement operations.
Similar content being viewed by others
References
Boothroyd, J.: Algorithm 246 Graycode. Commun. ACM 7(12), 701 (1964)
Buhrman, H., Miltersen, P.B., Radhakrishnan, J., Venkatesh, S.: Are bitvectors optimal? SIAM J. Comput. 31(6), 1723–1744 (2002)
Carlsson, S., Munro, J.I., Poblete, P.V.: An implicit priority queue with constant insertion time. In: Proceedings of 1st Scandinavian Workshop on Algorithm Theory, pp. 1–13 (1988)
Clancy, M.J., Knuth, D.E.: A programming and problem-solving seminar. Tech Report, Computer Science Dept., School of Humanities and Science, Stanford University, STAN-CS-77-606 (1977)
Cohn, M., Even, S.: A Gray code counter. IEEE Trans. Comput. 662–664 (1969)
Elias, P.: Efficient storage retrieval by content and address of static files. J. ACM 21(2), 246–260 (1974)
Elias, P., Flower, R.A.: The complexity of some simple retrieval problems. J. ACM 22, 367–379 (1975)
Er, M.C.: Remark on algorithm 246 (Gray code). ACM Trans. Math. Softw. 11(4), 441–443 (1985)
Fischman, A.F.: A gray code counter. IRE Trans. Electron. Comput. EC-6, 120 (1957)
Frandsen, G.S., Miltersen, P.B., Skyum, S.: Dynamic word problems. J. ACM 44, 257–271 (1997)
Fredman, M.L.: Observations on the complexity of generating quasi-gray codes. SIAM J. Comput. 7, 134–146 (1978)
Gray, F.: Pulse code communications. In: U.S. Patent 2632058 (1953)
Lucal, H.: Arithmetic operations for digital computers using a modified reflected binary code. IEEE Trans. Comput. 449–458 (1959)
Majithia, J.C.: Simple design for up/down gray-code counters. Electron. Lett. 7(22), 658–659 (1971)
Miltersen, P.B.: The bit probe complexity measure revisited. In: Proceedings of the Symposium on Theoretical Aspects of Computer Science, pp. 662–671 (1993)
Miltersen, P.B.: Lower bounds on the size of selection and rank indexes. In: Proceedings of the 16th Annual ACM/SIAM Symposium on Discrete Algorithms, pp. 11–12 (2005)
Minsky, M., Papert, S.: Perceptrons. MIT Press, Cambridge (1969)
Misra, J.: Remark on algorithm 246: Graycode[Z]. ACM Trans. Math. Softw. 1(3), 285 (1975)
Pätraşcu, C.E., Pätraşcu, M.: On dynamic bit-probe complexity. In: ICALP 2005, pp. 969–981 (2005)
Radhakrishnan, J., Raman, V., Rao, S.S.: Explicit deterministic constructions for membership in the bitprobe model. In: ESA 2001. Lecture Notes in Computer Science, vol. 2161, pp. 290–299. Springer, Berlin (2001)
Rahman, M.Z., Munro, J.I.: Colored predecessor problem in the bit probe model. In: Proceedings of 8th International Conference on Computer and Information Technology (ICCIT 05), pp. 19–22 (2005)
Rahman, M.Z., Munro, J.I.: Integer representation and counting in the bit probe model. In: ISAAC 2007. Lecture Notes in Computer Science, vol. 4835, pp. 5–16. Springer, Berlin (2007)
Yao, A.C.C.: Should tables be sorted? J. ACM 28, 615–628 (1981)
Author information
Authors and Affiliations
Corresponding author
Additional information
This work was supported by NSERC of Canada and The Canada Research Chairs Program.
A preliminary version of this paper appeared as [22].
Rights and permissions
About this article
Cite this article
Rahman, M.Z., Munro, J.I. Integer Representation and Counting in the Bit Probe Model. Algorithmica 56, 105–127 (2010). https://doi.org/10.1007/s00453-008-9247-2
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00453-008-9247-2