Efficient Generation of k-ary Trees in Natural Order
Author(s) -
M. C. Er
Publication year - 1992
Publication title -
the computer journal
Language(s) - English
Resource type - Journals
SCImago Journal Rank - 0.319
H-Index - 64
eISSN - 1460-2067
pISSN - 0010-4620
DOI - 10.1093/comjnl/35.3.306
Subject(s) - preorder , lexicographical order , set (abstract data type) , combinatorics , mathematics , tree (set theory) , sequence (biology) , order (exchange) , computer science , discrete mathematics , algorithm , finance , biology , economics , genetics , programming language
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
Accelerating Research
Robert Robinson Avenue,
Oxford Science Park, Oxford
OX4 4GP, United Kingdom
Address
John Eccles HouseRobert Robinson Avenue,
Oxford Science Park, Oxford
OX4 4GP, United Kingdom