Skip to content

NonRootBinaryNodes ​

The number of nodes other than the root with two children.

✓ checked against that system · ! checked, with disagreements (hover a chip)FindStatSt000252via BinaryTree✓
NonRootBinaryNodes(tree)The number of nodes other than the root with two children.
Typed signatures
TypePackageApplies
(binary_tree) -> numbercombinatoricsalways

Domain: Tree statistics

Details
  • Defined over BinaryTree as an expression in _x, evaluated by compute-engine — the definition IS the implementation.
  • Takes a BinaryTree and nothing else — it reads values against their positions, or walks the orbits, so it needs the bijection. Applying it to a bare list is a type error, not a wrong answer.
  • The nodes of degree 3 in the tree's drawing: two children and a parent.

Definition

Epsil, as the implementation runs it.

on BinaryTree, over _x

0 if _x in Integers else Apply(
                                Function(0 if t in Integers else (0 if t[1] in
                                                                       Integers else 0 if t[2] in Integers else 1) +
                                                                 self(
                                                                       self,
                                                                       t[1],
                                                                     ) +
                                                                 self(
                                                                       self,
                                                                       t[2],
                                                                     ), self, t),
                                Function(0 if t in Integers else (0 if t[1] in
                                                                       Integers else 0 if t[2] in Integers else 1) +
                                                                 self(
                                                                       self,
                                                                       t[1],
                                                                     ) +
                                                                 self(
                                                                       self,
                                                                       t[2],
                                                                     ), self, t),
                                _x[1],
                              ) + Apply(
                                        Function(0 if t in Integers else (0 if t[1] in
                                                                               Integers else 0 if t[2] in Integers else 1) +
                                                                         self(self, t[1]) +
                                                                         self(self, t[2]), self, t),
                                        Function(0 if t in Integers else (0 if t[1] in
                                                                               Integers else 0 if t[2] in Integers else 1) +
                                                                         self(self, t[1]) +
                                                                         self(self, t[2]), self, t),
                                        _x[2],
                                      )

Examples

Basic #

the binary tree [[.,.],[[.,.],.]][[.,.],[[.,.],.]]

live ↗
InNonRootBinaryNodes(BinaryTree⁡([[0,0],[[0,0],0]]))\mathrm{NonRootBinaryNodes}({\operatorname{BinaryTree}}(\bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, \bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, 0\bigr\rbrack\bigr\rbrack))Out00
Properties #

FindStat's value for [.,.]

live ↗
InCombinatorialStat(BinaryTree⁡([0,0]),NonRootBinaryNodes)\mathrm{CombinatorialStat}({\operatorname{BinaryTree}}(\bigl\lbrack0, 0\bigr\rbrack), \text{NonRootBinaryNodes})Out00

Known value · FindStat St000252

FindStat's value for [.,[.,.]]

live ↗
InCombinatorialStat(BinaryTree⁡([0,[0,0]]),NonRootBinaryNodes)\mathrm{CombinatorialStat}({\operatorname{BinaryTree}}(\bigl\lbrack0, \bigl\lbrack0, 0\bigr\rbrack\bigr\rbrack), \text{NonRootBinaryNodes})Out00

Known value · FindStat St000252

FindStat's value for [[.,.],.]

live ↗
InCombinatorialStat(BinaryTree⁡([[0,0],0]),NonRootBinaryNodes)\mathrm{CombinatorialStat}({\operatorname{BinaryTree}}(\bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, 0\bigr\rbrack), \text{NonRootBinaryNodes})Out00

Known value · FindStat St000252

About
Examples4
CrosswalkFindStat