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.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.