Ranking and unranking trees using regular reductions

  • Pierre Kelsen
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1046)


We consider the problem of defining a linear order on a set of combinatorial objects so that the following two operations can be performed efficiently: (1) determine the rank of an object in the linear order (ranking); (2) compute an object from its rank (unranking). Typical applications of such an ordering include testing a program on a random or selected set of input instances and searching for counterexamples of a conjecture involving structured objects. We reduce the problem of finding such a linear order to the problem of constructing a special mapping on the set of combinatorial objects called regular reduction. We demonstrate the power of regular reductions by developing O(n) time procedures for ranking and unranking B-trees on n leaves after O(n2) time preprocessing; the best previous ordering algorithm, although also running in linear time, required exponential time and space preprocessing. Our new paradigm also yields improved ranking and unranking algorithms for binary trees of bounded height and for height-balanced trees (see [7]).


Recurrence Relation Linear Order Rooted Tree Regular Tree Weighted Tree 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    A.V. Aho, J.E. Hopcroft, J.D. Ullman, The design and analysis of computer algorithms, Addison-Wesley, 1974.Google Scholar
  2. 2.
    G.M. Adel'son-Vel'skii and Y.M. Landis, An algorithm for the organization of information, Doklad. Akad. Nauk SSSR, 146 (1962), pp. 263–266; Soviet math. Dokl., 3 (1962), pp. 1259–1262.Google Scholar
  3. 3.
    C. Berge, Principles of combinatorics, Academic Press, New York, 1971.Google Scholar
  4. 4.
    R. Bayer and E. McCreight, Organization and maintenance of large ordered indexes, Acta Inform. 1 (1972), pp. 173–189.CrossRefGoogle Scholar
  5. 5.
    U.I. Gupta, D.T. Lee and C.K. Wong, Ranking and unranking of B-trees, Journal of Algorithms 4(1983), pp. 51–60.CrossRefGoogle Scholar
  6. 6.
    U.I. Gupta, D.T. Lee and C.K. Wong, Ranking and unranking of 2–3 trees, SIAM J. Comput. 11(1982), pp. 582–590.CrossRefGoogle Scholar
  7. 7.
    P. Kelsen, Ranking and unranking trees using regular reductions, Technical Report 93-37, Department of Computer Science, University of British Columbia, 1993.Google Scholar
  8. 8.
    D.E. Knuth, The art of computer programming, vol. 3: Sorting and Searching, Addison-Wesley, Reading, MA, 1973.Google Scholar
  9. 9.
    L. Li, Ranking and unranking of AVL-trees, SIAM J. Comput. 15 (1986), pp. 1025–1035.CrossRefGoogle Scholar
  10. 10.
    C.C Lee, D.T. Lee and C.K. Wong, Generating binary trees of bounded height, Acta Informatica 23, 529–544 (1986).CrossRefGoogle Scholar
  11. 11.
    F. Ruskey and T.C. Hu, Generating binary trees lexicographically, SIAM J. Comput. 6 (1977), pp. 745–758.CrossRefGoogle Scholar
  12. 12.
    F. Ruskey and D. Roelants van Baronaigien, Fast recursive algorithms for generating combinatorial objects, Congressus Numerantium, vol. 41 (1984), pp. 53–62.Google Scholar
  13. 13.
    H. Wilf, A unified setting for sequencing, ranking and selection algorithms for combinatorial objects, Advances in Mathematics, 24 (1977), pp.281–291.Google Scholar
  14. 14.
    S.G. Williamson, On the ordering, ranking and random generation of basic combinatorial sets, Lecture Notes in Mathematics, 579, Springer-Verlag, Berlin, 1976.Google Scholar
  15. 15.
    S. Zaks, Lexicographic generation of ordered trees, Theoretical Computer Science 10 (1980), pp, 63–82.CrossRefGoogle Scholar
  16. 16.
    S. Zaks, Generating trees and other combinatorial objects lexicographically, SIAM J. Comput. 8 (1979), pp. 73–81.CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1996

Authors and Affiliations

  • Pierre Kelsen
    • 1
  1. 1.Max-Planck Institut für InformatikSaarbrücken

Personalised recommendations