EFFICIENT GENERATION OF K-ARY TREES IN NATURAL ORDER

被引:21
|
作者
ER, MC
机构
[1] Department of Mathematics and Computing Sciences, St. Francis Xavier University, Antigonish
来源
COMPUTER JOURNAL | 1992年 / 35卷 / 03期
关键词
D O I
10.1093/comjnl/35.3.306
中图分类号
TP3 [计算技术、计算机技术];
学科分类号
0812 ;
摘要
A k-ary tree with n nodes can be encoded as a k-inorder-preorder sequence of length (k - 1) n by labelling the tree from 1 to (k - 1) n in generalised inorder and then reading off the labelled integers in generalised preorder. The natural ordering of a set of k-ary trees with n nodes is shown to be preserved in the lexicographic ordering of a set of k-inorder-preorder sequences of length (k - 1) n. An efficient algorithm for generating a set of k-inorder-preorder sequences in lexicographic order is presented. This set of k-inorder-preorder sequences can subsequently be converted to the corresponding set of k-ary trees in natural order.
引用
收藏
页码:306 / 308
页数:3
相关论文
共 50 条