ACT 1: Ash Counting Trees

Ash Ketchum has a weird rooted tree (read Notes sections if you don’t know about tree data structure). The tree has an infinite number of nodes (vertices). Each node has exactly $K$ child nodes. Ash named such trees $K$-child trees. That means, if $K = 2$, it is called a 2-child tree and the tree is an infinite binary tree. Similarly, a 3-child tree is an infinite ternary tree and so on. Initially, all the nodes in the tree are empty.


This is a companion discussion topic for the original entry at https://toph.co/p/act-1-ash-counting-trees