Abstract
We introduce two numeral systems, the magical skew system and the regular skew system, and contribute to their theory development. For both systems, increments and decrements are supported using a constant number of digit changes per operation. Moreover, for the regular skew system, the operation of adding two numbers is supported efficiently. Our basic message is that some data-structural problems are better formulated at the level of a numeral system. The relationship between number representations and data representations, as well as operations on them, can be utilized for an elegant description and a clean analysis of algorithms. In many cases, a pure mathematical treatment may also be interesting in its own right. As an application of numeral systems to data structures, we consider how to implement a priority queue as a forest of pointer-based binary heaps. Some of the number-representation features that influence the efficiency of the priority-queue operations include weighting of digits, carry-propagation and borrowing mechanisms.
Similar content being viewed by others
References
Elmasry, A., Jensen, C., Katajainen, J.: The magic of a number system. In: Proceedings of the 5th International Conference on Fun with Algorithms. Lecture Notes in Computer Science, vol. 6099, pp. 156–165. Springer, Berlin (2010)
Vuillemin, J.: A data structure for manipulating priority queues. Commun. ACM 21(4), 309–315 (1978)
Clancy, M., Knuth, D.: A programming and problem-solving seminar. Technical report STAN-CS-77-606, Department of Computer Science, Stanford University (1977)
Myers, E.W.: An applicative random-access stack. Inf. Process. Lett. 17(5), 241–248 (1983)
Okasaki, C.: Purely Functional Data Structures. Cambridge University Press, Cambridge (1998)
Williams, J.W.J.: Algorithm 232: Heapsort. Commun. ACM 7(6), 347–348 (1964)
Gonnet, G.H., Munro, J.I.: Heaps on heaps. SIAM J. Comput. 15(4), 964–971 (1986)
Carlsson, S., Munro, J.I., Poblete, P.V.: An implicit binomial queue with constant insertion time. In: Proceedings of the 1st Scandinavian Workshop on Algorithm Theory. Lecture Notes in Computer Science, vol. 318, pp. 1–13. Springer, Berlin (1988)
Brodal, G.S., Okasaki, C.: Optimal purely functional priority queues. J. Funct. Program. 6(6), 839–857 (1996)
Sack, J.R., Strothotte, T.: A characterization of heaps and its applications. Inf. Comput. 86(1), 69–86 (1990)
Bansal, S., Sreekanth, S., Gupta, P.: M-heap: A modified heap data structure. Int. J. Found. Comput. Sci. 14(3), 491–502 (2003)
Harvey, N.J.A., Zatloukal, K.: The post-order heap. In: Proceedings of the 3rd International Conference on Fun with Algorithms (2004)
Elmasry, A., Jensen, C., Katajainen, J.: Multipartite priority queues. ACM Trans. Algorithms 5(1), 14:1–14:19 (2008)
Elmasry, A., Jensen, C., Katajainen, J.: Two-tier relaxed heaps. Acta Inform. 45(3), 193–210 (2008)
Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 3rd edn. MIT Press, Cambridge (2009)
Brown, M.R.: Implementation and analysis of binomial queue algorithms. SIAM J. Comput. 7(3), 298–319 (1978)
Fredman, M.L., Tarjan, R.E.: Fibonacci heaps and their uses in improved network optimization algorithms. J. ACM 34(3), 596–615 (1987)
Author information
Authors and Affiliations
Corresponding author
Additional information
A preliminary version of this paper entitled “The magic of a number system” [1] was presented at the 5th International Conference on Fun with Algorithms held on Ischia Island in June 2010.
A. Elmasry was supported by the Alexander von Humboldt Foundation and the VELUX Foundation.
J. Katajainen was partially supported by the Danish Natural Science Research Council under contract 09-060411 (project “Generic programming—algorithms and tools”).
Rights and permissions
About this article
Cite this article
Elmasry, A., Jensen, C. & Katajainen, J. Two Skew-Binary Numeral Systems and One Application. Theory Comput Syst 50, 185–211 (2012). https://doi.org/10.1007/s00224-011-9357-0
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00224-011-9357-0