Back

Trees

Recursively enumerating all possible sparse binary trees is easy. Far harder is coming up with a stable mapping between the integers and this set of trees. I was able to do this after a lot of thought.
The code is here, but it is from like four years ago, so please be warned.