Skip to content

LeftSpine ​

The number of nodes on the left spine of a binary tree: the root and its chain of left children.

✓ checked against that system · ! checked, with disagreements (hover a chip)FindStatSt000061via BinaryTree✓
LeftSpine(tree)The number of nodes on the left spine of a binary tree: the root and its chain of left 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.
  • Counts nodes, root included.

Definition

Epsil, as the implementation runs it.

on BinaryTree, over _x

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

Examples

Basic #

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

live ↗
InLeftSpine(BinaryTree⁡([[0,0],[[0,0],0]]))\mathrm{LeftSpine}({\operatorname{BinaryTree}}(\bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, \bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, 0\bigr\rbrack\bigr\rbrack))Out22
Properties #

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

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

Known value · FindStat St000061

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

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

Known value · FindStat St000061

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

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

Known value · FindStat St000061

About
Examples4
CrosswalkFindStat