Skip to content

VertexHeightSum ​

The sum, over the nodes, of the node's height (the most nodes on a path down).

✓ checked against that system · ! checked, with disagreements (hover a chip)FindStatSt000569via BinaryTree✓
VertexHeightSum(tree)The sum, over the nodes, of the node's height (the most nodes on a path down).
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.

Definition

Epsil, as the implementation runs it.

on BinaryTree, over _x

Apply(
       Function([0, 0] if t in Integers else Apply(
                                                    (
                                                      a: collection,
                                                      b: collection,
                                                    ) => [
                                                          1 + Max(a[1], b[1]),
                                                          1 + Max(a[1], b[1]) +
                                                          a[2] + b[2],
                                                        ],
                                                    self(self, t[1]),
                                                    self(self, t[2]),
                                                  ), self, t),
       Function([0, 0] if t in Integers else Apply(
                                                    (
                                                      a: collection,
                                                      b: collection,
                                                    ) => [
                                                          1 + Max(a[1], b[1]),
                                                          1 + Max(a[1], b[1]) +
                                                          a[2] + b[2],
                                                        ],
                                                    self(self, t[1]),
                                                    self(self, t[2]),
                                                  ), self, t),
       _x,
     )[2]

Examples

Basic #

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

live ↗
InVertexHeightSum(BinaryTree⁡([[0,0],[[0,0],0]]))\mathrm{VertexHeightSum}({\operatorname{BinaryTree}}(\bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, \bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, 0\bigr\rbrack\bigr\rbrack))Out77
Properties #

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

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

Known value · FindStat St000569

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

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

Known value · FindStat St000569

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

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

Known value · FindStat St000569

About
Examples4
CrosswalkFindStat