Lexicographic Listing and Ranking of t-ary Trees
Open Access
- 1 December 1987
- journal article
- Published by Oxford University Press (OUP) in The Computer Journal
- Vol. 30 (6) , 569-572
- https://doi.org/10.1093/comjnl/30.6.569
Abstract
This paper presents three simple and efficient algorithms for generating, ranking and unranking t-ary trees in a lexicographic order. The simplest idea of encoding a t-ary tree with n nodes as a bit-string of length t*n is exploited to its full advantages. It is proved that the lexicographic order in the set of t-ary trees with n nodes is preserved in the set of bit-strings of length t*n, using the above encoding scheme. Thus by generating all bit-strings in the lexicographic order, a simple decoding algorithm can convert them to t-ary trees in the same order. Finally, the theoretical basis for ranking a lexicographic listing of bit-strings is discussed, and the ranking and the unranking algorithms are derived.Keywords
This publication has 0 references indexed in Scilit: