Given \(N\), how do I generate all the valid push/pop sequences (or draw all the trees)? I’ll generate the sequence of 1’s and 0’s....
We showed that the number of binary trees with \(N\) nodes is the Catalan numbers. It is also the number of valid push/pop sequences for...
Say we have the numbers from 1 to \(N\) in sequence. We will do a random sequence of pushes and pops into a stack: \(N\) pushes and...
Suppose we want to populate \(2n\) positions with exactly \(n\) 1’s and \(n\) -1’s. But we have a constraint. For any given \(k\) where...
Problem How many bits are needed to represent a binary tree with \(n\) nodes? A lower bound is given by the fact that \(m\) bits can...