{"title":"Simple random sampling of binary forests with fixed number of nodes and trees","authors":"Stoyan Dimitrov","doi":"10.1016/j.tcs.2025.115418","DOIUrl":null,"url":null,"abstract":"<div><div>We generalize the classical algorithm of Rémy for random sampling of full binary trees with a given number of leaves. As a result, we give a simple linear time algorithm for random generation of full binary forests with given number of trees and leaves. The algorithm is obtained from a bijection that we construct in order to give a direct proof of the well-known fact that these forests are enumerated by the <em>k</em>-th fold self-convolution of the Catalan numbers. Via some well-known bijections, the given algorithm can be used to sample random objects from several other classes enumerated by self-convolutions of the Catalan numbers, e.g., binary forests with a given number of trees, lists of a given number of balanced strings and others.</div></div>","PeriodicalId":49438,"journal":{"name":"Theoretical Computer Science","volume":"1051 ","pages":"Article 115418"},"PeriodicalIF":1.0000,"publicationDate":"2025-06-16","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Theoretical Computer Science","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0304397525003561","RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, THEORY & METHODS","Score":null,"Total":0}
引用次数: 0
Abstract
We generalize the classical algorithm of Rémy for random sampling of full binary trees with a given number of leaves. As a result, we give a simple linear time algorithm for random generation of full binary forests with given number of trees and leaves. The algorithm is obtained from a bijection that we construct in order to give a direct proof of the well-known fact that these forests are enumerated by the k-th fold self-convolution of the Catalan numbers. Via some well-known bijections, the given algorithm can be used to sample random objects from several other classes enumerated by self-convolutions of the Catalan numbers, e.g., binary forests with a given number of trees, lists of a given number of balanced strings and others.
期刊介绍:
Theoretical Computer Science is mathematical and abstract in spirit, but it derives its motivation from practical and everyday computation. Its aim is to understand the nature of computation and, as a consequence of this understanding, provide more efficient methodologies. All papers introducing or studying mathematical, logic and formal concepts and methods are welcome, provided that their motivation is clearly drawn from the field of computing.