Abstract

A non-regular tree T with a prescribed branching sequence (s 1,s 2,…,s n ) is an ordered tree whose internal nodes are numbered from 1 to n in preorder such that every node i in T has s i children. Recently, Wu et al. (2010) introduced a concise representation called RD-sequences to represent all non-regular trees and proposed a loopless algorithm for generating all non-regular trees in a Gray-code order. In this paper, based on such a Gray-code order, we present efficient ranking and unranking algorithms of non-regular trees with n internal nodes. Moreover, we show that each of the algorithms can be run in \({\mathcal O}(n^2)\) time provided a preprocessing takes \({\mathcal O}(n^2S_{n-1})\) time and space in advance, where \(S_{n-1}=\sum_{i=1}^{n-1}(s_i-1)\).

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

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.