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)\).
This work was partially supported by the National Science Council of Taiwan under contracts NSC101-2221-E-262-020 and NSC101-2115-M-141-001.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Ahmadi-Adl, A., Nowzari-Dalini, A., Ahrabian, H.: Ranking and unranking algorithms for loopless generation of t-ary trees. Logic J. IGPL 19, 33–43 (2011)
Ahrabian, H., Nowzari-Dalini, A.: Generation of t-ary trees with ballot-sequences. Int. J. Comput. Math. 80, 1243–1249 (2003)
Er, M.C.: Lexicographic listing and ranking t-ary trees. Comput. J. 30, 569–572 (1987)
Er, M.C.: A simple algorithm for generating non-regular trees in lexicographic order. Comput. J. 31, 61–64 (1988)
Korsh, J.F.: Loopless generation of k-ary tree sequences. Inform. Process. Lett. 52, 243–247 (1994)
Korsh, J.F., LaFollette, P.: Loopless generation of Gray codes for k-ary trees. Inform. Process. Lett. 70, 7–11 (1999)
Korsh, J.F., LaFollette, P.: A loopless Gray code for rooted trees. ACM Trans. Algorithms 2, 135–152 (2006)
Korsh, J.F., Lipschutz, S.: Shift and loopless generation of k-ary trees. Inform. Process. Lett. 65, 235–240 (1998)
Roelants van Baronaigien, D.: A loopless Gray-code algorithm for listing k-ary trees. J. Algorithms 35, 100–107 (2000)
Roelants van Baronaigien, D., Ruskey, F.: Generating t-ary trees in A-order. Inform. Process. Lett. 27, 205–213 (1988)
Ruskey, F.: Generating t-ary trees lexicographically. SIAM J. Comput. 7, 424–439 (1978)
Savage, C.D.: A survey of combinatorial Gray codes. SIAM Review 39, 605–629 (1997)
Trojanowaki, A.E.: Ranking and listing algorithms for k-ary trees. SIAM J. Comput. 7, 492–509 (1978)
Wu, R.-Y., Chang, J.-M., Chang, C.-H.: Ranking and unranking of non-regular trees with a prescribed branching sequence. Math. Comput. Modelling 53, 1331–1335 (2011)
Wu, R.-Y., Chang, J.-M., Wang, Y.-L.: Loopless Generation of non-regular trees with a prescribed branching sequence. Comput. J. 53, 661–666 (2010)
Wu, R.-Y., Chang, J.-M., Wang, Y.-L.: Ranking and unranking of t-ary trees using RD-sequences. IEICE Trans. Inform. Sys. E94-D, 226–232 (2011)
Xiang, L., Ushijima, K., Tang, C.: Efficient loopless generation of Gray codes for k-ary trees. Inform. Process. Lett. 76, 169–174 (2000)
Zaks, S.: Lexicographic generation of ordered trees. Theore. Comput. Sci. 10, 63–82 (1980)
Zaks, S.: Generation and ranking of k-ary trees. Inform. Process. Lett. 14, 44–48 (1982)
Zaks, S., Richards, D.: Generating trees and other combinatorial objects lexicographically. SIAM J. Comput. 81, 73–81 (1979)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2013 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Wu, RY., Chang, JM., Chen, AH., Ko, MT. (2013). Ranking and Unranking Algorithms for Loopless Generation of Non-regular Trees. In: Chang, RS., Jain, L., Peng, SL. (eds) Advances in Intelligent Systems and Applications - Volume 1. Smart Innovation, Systems and Technologies, vol 20. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-35452-6_12
Download citation
DOI: https://doi.org/10.1007/978-3-642-35452-6_12
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-35451-9
Online ISBN: 978-3-642-35452-6
eBook Packages: EngineeringEngineering (R0)