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… (More)
After the publication of Algorithm 246, Misra [l] suggested an improvement to it. He gave no detailed coding; but from his descriptions, we obtain the following algorithm for generating the binary Gray code of N bits, assuming that A [l. . N] is an array of bits, which is initialized to all 0's.