Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

When generating random binary tree, what's the meaning of empty nodes? #12

@skywildworld

Description

@skywildworld

According to https://github.com/facebookresearch/SymbolicMathematics/blob/master/src/envs/char_sp.py,

D[e][n] represents the number of different binary trees with n nodes that
can be generated from e empty nodes, using the following recursion:
D(0, n) = 0
D(1, n) = C_n (n-th Catalan number)
D(e, n) = D(e - 1, n + 1) - D(e - 2, n + 1)

I understand D(1,n) as number of different random binary tree with n node, but what is the meaning of e "empty node" in D(e,n)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions