Building a tree inside out dynamically?

I think this is what I want, correct?