Abstract

Two ‘natural’ orders have been defined on the set of t-ary trees. Zaks (1980) referred to these orders as A-order and B-order. Many algorithms have been developed for generating binary and t-ary trees in B-order. Here we develop an algorithm for generating all t-ary trees with n nodes in (reverse) A-order, as well as ranking and unranking algorithms. The generation algorithm produces each tree in constant average time. The analysis of the generation algorithm makes use of an interesting bijection on the set of t-ary trees. The ranking algorithm runs in O( tn) time and the unranking algorithm in O( tn lg n) time.

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