### Leaves and interior nodes in binary trees

*claim: In any binary tree where each interior node has two children, it is the case that #leaves = #interior nodes + 1.*

We did an in-class exercise to try prove this claim.
Students came up with inductive proofs and a direct counting argument.
Instructor proposed the following proof:

proof: Put a coin on each leaf. Then repeat the following process:

- For any interior node without a coin where each child has at least one coin, take a coin from each of the two children and put these two coins on the node.

When the process finishes, each leaf has no coins, each interior node has one coin, and the root has two coins.

Since the number of coins is the same before and after this process,

- #leaves = #coins before = #coins after = #interior nodes + 1

Had some discussion of what constitutes a proof.

We discussed GeometricSums
and the GrowableArray
data structure.