Abstract

The bit sequence representation for k-ary trees is a sequence b1,b2,…,bnk+1 of bits that is formed by doing a preorder traversal of the k-ary tree and writing a 1 when the visited subtree is not empty and a zero when the visited subtree is empty. The representation is well known and in the case of binary trees, the bit sequence representation also represents well-formed parenthesis strings. This paper presents the first loopless algorithm for listing the bit sequence representations of k-ary trees in a Gray-code order. The algorithm is simpler than existing loop free algorithms for both binary and k-ary trees. The algorithm is also the only known algorithm that generates the bit sequences by homogeneous transpositions.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call