Efficient generation of plane trees
โ Scribed by Shin-ichi Nakano
- Publisher
- Elsevier Science
- Year
- 2002
- Tongue
- English
- Weight
- 96 KB
- Volume
- 84
- Category
- Article
- ISSN
- 0020-0190
No coin nor oath required. For personal study only.
โฆ Synopsis
A rooted plane tree is a rooted tree with a left-to-right ordering specified for the children of each vertex. In this paper we give a simple algorithm to generate all rooted plane trees with at most n vertices. The algorithm uses O(n) space and generates such trees in O(1) time per tree without duplications. The algorithm does not output entire trees but the difference from the previous tree. By modifying the algorithm we can generate without duplications all rooted plane trees having exactly n vertices in O(1) time per tree, all rooted plane trees having at most n vertices with maximum degree at most D in O(1) time per tree, and all rooted plane trees having exactly n vertices including exactly c leaves in O(nc) time per tree. Also we can generate without duplications all (non-rooted) plane trees having exactly n vertices in O(n 3 ) time per tree.
๐ SIMILAR VOLUMES