Skip to main content

Regular numeral systems for data structures


We formalize several regular numeral systems, state their properties and supported operations, clarify the correctness, and tabulate the proofs. Our goal is to use as few symbols in the presentation of digits and make as few digit changes as possible in every operation. Most importantly, we introduce two new systems: (1) the buffered regular system is simple and allows the increment and decrement of the least-significant digit in constant time, and (2) the strictly regular system allows the increment and decrement of a digit at arbitrary position with a constant number of digit changes while using three symbols only (instead of four symbols required by the extended regular system). To demonstrate the usefulness of the regular systems, we survey how they have been used in the design of data structures.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3
Fig. 4


  1. 1.

    Aho, A.V., Lam, M.S., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, & Tools, 2nd edn. Pearson Education Inc, London (2007)

    MATH  Google Scholar 

  2. 2.

    Avizienis, A.: Signed-digit numbe[r] representations for fast parallel arithmetic. IRE Trans. Electron. Comput EC–10(3), 389–400 (1961)

  3. 3.

    Bitner, J.R., Ehrlich, G., Reingold, E.M.: Efficient generation of the binary reflected Gray code and its applications. Commun. ACM 19(9), 517–521 (1976)

    MathSciNet  Article  Google Scholar 

  4. 4.

    Boothroyd, J.: Algorithm 246: Graycode. Commun. ACM 7(12), 701 (1964)

    Article  Google Scholar 

  5. 5.

    Bose, P., Carmi, P., Jansens, D., Maheshwari, A., Morin, P,, Smid, M.: Improved methods for generating quasi-Gray codes. In: 12th Scandinavian Symposium and Workshops on Algorithm Theory, Volume 6139 of Lecture Notes in Computer Science, pp. 224–235. Springer (2010)

  6. 6.

    Brodal, G.: Fast meldable priority queues. In: 4th International Workshop on Algorithms and Data Structures, volume 955 of Lecture Notes in Computer Science, pp. 282–290. Springer (1995)

  7. 7.

    Brodal, G.: Worst-case efficient priority queues. In: 7th Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 52–58. SIAM (1996)

  8. 8.

    Brodal, G., Greve, M., Pandey, V., Rao, S.S.: Integer representations towards efficient counting in the bit probe model. In: 8th Annual Conference on Theory and Applications of Models of Computation, Volume 6648 of Lecture Notes in Computer Science, pp. 206–217. Springer (2011)

  9. 9.

    Brown, M.R.: Implementation and analysis of binomial queue algorithms. SIAM J. Comput. 7(3), 298–319 (1978)

    MathSciNet  Article  Google Scholar 

  10. 10.

    Carlsson, S., Munro, J.I., Poblete, P.V.: An implicit binomial queue with constant insertion time. In: 1st Scandinavian Workshop on Algorithm Theory, Volume 318 of Lecture Notes in Computer Science, pp. 1–13. Springer (1988)

  11. 11.

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

  12. 12.

    Collignon, E.: Note sur l’arithmétique binaire. Journal de Mathématiques Élémentaires, 21, 101–106, 126–131, 148–151, 171–174 (1897)

  13. 13.

    Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 3rd edn. The MIT Press, Cambridge (2009)

    MATH  Google Scholar 

  14. 14.

    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)

    MathSciNet  Article  Google Scholar 

  15. 15.

    Ronald, D.: Dutton. Weak-heap sort. BIT 33(3), 372–381 (1993)

    MathSciNet  Article  Google Scholar 

  16. 16.

    Edelkamp, S., Elmasry, A., Katajainen, J.: The weak-heap data structure: variants and applications. J. Discrete Algorithms 16, 187–205 (2012)

    MathSciNet  Article  Google Scholar 

  17. 17.

    Edelkamp, S., Elmasry, A., Katajainen, J.: The weak-heap family of priority queues in theory and praxis. In: 18th Computing: The Australasian Theory Symposium, Volume 128 of Conferences in Research and Practice in Information Technology, pp. 103–112. Australian Computer Society, Inc. (2012)

  18. 18.

    Elmasry, A.: A priority queue with the working-set property. Int. J. Found. Comput. Sci. 17(6), 1455–1465 (2006)

    MathSciNet  Article  Google Scholar 

  19. 19.

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

  20. 20.

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

    MathSciNet  Article  Google Scholar 

  21. 21.

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

    MathSciNet  Article  Google Scholar 

  22. 22.

    Elmasry, A., Jensen, C., Katajainen, J.: The magic of a number system. In: 5th International Conference on Fun with Algorithms, Volume 6099 of Lecture Notes in Computer Science, pp. 156–165. Springer (2010)

  23. 23.

    Elmasry, A., Jensen, C., Katajainen, J.: Strictly-regular number system and data structures. In: 12th Scandinavian Symposium and Workshops on Algorithm Theory, Volume 6139 of Lecture Notes in Computer Science, pp. 26–37. Springer (2010)

  24. 24.

    Elmasry, A., Jensen, C., Katajainen, J.: Two skew-binary numeral systems and one application. Theory Comput. Syst. 50(1), 185–211 (2012)

    MathSciNet  Article  Google Scholar 

  25. 25.

    Elmasry, A., Jensen, C., Katajainen, J.: Bipartite binomial heaps. RAIRO Theor. Inform. Appl. 51(3), 121–133 (2017)

    MathSciNet  Article  Google Scholar 

  26. 26.

    Elmasry, A., Kahla, M., Ahdy, F., Hashem, M.: Red-black trees with constant update time. Acta Inform. 56(5), 391–404 (2019)

    MathSciNet  Article  Google Scholar 

  27. 27.

    Elmasry, A., Katajainen, J.: Worst-case optimal priority queues via extended regular counters. In: 7th International Computer Science Symposium in Russia, Volume 7353 of Lecture Notes in Computer Science, pp. 130–142. Springer (2012)

  28. 28.

    Elmasry, A., Katajainen, J.: Fat heaps without regular counters. Discrete Math. Algorithms Appl., 5(2) (2013)

  29. 29.

    Elmasry, A., Katajainen, J.: In-place binary counters. In: 38th International Symposium on Mathematical Foundations of Computer Science, Volume 8087 of Lecture Notes in Computer Science, pp. 349–360. Springer (2013)

  30. 30.

    Glaser, A.: History of Binary and Other Nondecimal Numeration. Tomash Publishers, revised edition (1981)

  31. 31.

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

  32. 32.

    Guibas, L.J., McCreight, E.M., Plass, M.F., Roberts, J.R.: A new representation for linear lists. In: 9th Annual ACM Symposium on Theory of Computing, pp. 49–60. ACM (1977)

  33. 33.

    Guibas, L.J., Sedgewick, R.: A dichromatic framework for balanced trees. In: 19th Annual Symposium on Foundations of Computer Science, pp. 8–21. IEEE (1978)

  34. 34.

    Hagerup, T.: Sorting and searching on the word RAM. In: 15th Annual Symposium on Theoretical Aspects of Computer Science, Volume 1373 of Lecture Notes in Computer Science, pp. 366–398. Springer (1998)

  35. 35.

    Hood, R., Melville, R.: Real-time queue operations in Pure LISP. Inf. Process. Lett. 13(2), 50–54 (1981)

    Article  Google Scholar 

  36. 36.

    Kaplan, H., Shafrir, N., Tarjan, R.E.: Meldable heaps and Boolean union-find. In: 34th Annual ACM Symposium on Theory of Computing, pp. 573–582. ACM (2002)

  37. 37.

    Kaplan, H., Tarjan, R.E.: Purely functional representations of catenable sorted lists. In:28th Annual ACM Symposium on Theory of Computing, pp. 202–211. ACM (1996)

  38. 38.

    Kaplan, H., Tarjan, R.E.: New heap data structures. Technical Report TR-597-99, Department of Computer Science, Princeton University (1999)

  39. 39.

    Kaplan, H., Tarjan, R.E.: Purely functional, real-time deques with catenation. J. ACM 46(5), 577–603 (1999)

    MathSciNet  Article  Google Scholar 

  40. 40.

    Katajainen, J.: Worst-case-efficient dynamic arrays in practice. In: 15th International Symposium on Experimental Algorithms, Volume 9685 of Lecture Notes in Computer Science, pp. 167–183. Springer (2016)

  41. 41.

    Katajainen, J.M., Bjarke, B.: Experiences with the design and implementation of space-efficient deques. In: 5th International Workshop on Algorithm Engineering, Volume 2141 of Lecture Notes in Computer Science, pp. 39–50. Springer (2001)

  42. 42.

    Kernighan, B.W., Ritchie, D.M.: The C Programming Language, 2nd edn. Prentice Hall PTR, Hoboken (1988)

    MATH  Google Scholar 

  43. 43.

    Knuth, D.E.: Sorting and Searching, Volume 3 of The Art of Computer Programming, 2nd edn. Addison Wesley, Longman (1998)

    Google Scholar 

  44. 44.

    Knuth, D.E.: Combinatorial Algorithms: Part 1, Volume 4A of The Art of Computer Programming. Addison-Wesley, Longman (2011)

    MATH  Google Scholar 

  45. 45.

    Koren, I.: Computer Arithmetic Algorithms, 2nd edn. A. K. Peters, Ltd, Natick (2002)

    MATH  Google Scholar 

  46. 46.

    Mehta, H., Owens, R.M., Irwin, M.J.: Some issues in Gray code addressing. In: 6th Great Lakes Symposium on VLSI, pp. 178–181. IEEE Computer Society (1996)

  47. 47.

    Metze, G., Robertson, J.E.: Elimination of carry propagation in digital computers. In: International Conference on Information Processing, pp. 389–396. UNESCO (1960)

  48. 48.

    Myers, E.W.: An applicative random-access stack. Inf. Process. Lett. 17(5), 241–248 (1983)

    MathSciNet  Article  Google Scholar 

  49. 49.

    Okasaki, C.: Simple and efficient purely functional queues and deques. J. Funct. Program. 5(4), 583–592 (1995)

    Article  Google Scholar 

  50. 50.

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

    Book  Google Scholar 

  51. 51.

    O’Neill, M.E., Burton, F.W.: A new method for functional arrays. J. Funct. Program. 7(5), 487–513 (1997)

    MathSciNet  Article  Google Scholar 

  52. 52.

    Parhami, B.: Generalized signed-digit number systems: a unifying framework for redundant number representations. IEEE Trans. Comput. 39(1), 89–98 (1990)

    Article  Google Scholar 

  53. 53.

    Parhami, B.: Computer Arithmetic: Algorithms and Hardware Designs, 2nd edn. Oxford University Press, Oxford (2009)

    Google Scholar 

  54. 54.

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

    MathSciNet  Article  Google Scholar 

  55. 55.

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

    MathSciNet  Article  Google Scholar 

  56. 56.

    Williams, J.W.J.: Algorithm 232: heapsort. Commun. ACM 7(6), 347–348 (1964)

    Article  Google Scholar 

Download references


We would like to thank the editor and the reviewers for thoroughly reading the paper and for their valuable comments that contributed in enhancing the writeup.

Author information



Corresponding author

Correspondence to Amr Elmasry.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Jyrki Katajainen has passed away after the submission of the first version of the paper to the journal.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Elmasry, A., Katajainen, J. Regular numeral systems for data structures. Acta Informatica (2021).

Download citation