30
Views
2
CrossRef citations to date
0
Altmetric
Original Articles

On the generation of binary trees from (0–1) codes

&
Pages 243-251 | Published online: 19 Mar 2007
 

Abstract

An efficient recursive a algorithm for the generating all shapes of binary trees with n-nodes is presented. A binary tree with n-nodes is represented by 2(n−1) zeros and ones in a certain predetermined order. This scheme encodes the non-null links of a binary tree by 1's and the null links by 0's in a pre-order traversal. The algorithm generates C n numbers of such codes. The algorithm is based on the idea of shifting ‘1' bits one space to the right. It is shown that the generation time per tree is constant O(1). The ranking and unranking algorithms are discussed. Also, an alternate way to obtain the Catalan numbers is given.

Corresponding author.

Corresponding author.

Notes

Corresponding author.

Additional information

Notes on contributors

A. Nowzari-Dalini

b

Reprints and Corporate Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

To request a reprint or corporate permissions for this article, please click on the relevant link below:

Academic Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

Obtain permissions instantly via Rightslink by clicking on the button below:

If you are unable to obtain permissions via Rightslink, please complete and submit this Permissions form. For more information, please visit our Permissions help page.