in reply to Re^3: out of order tree generationin thread out of order tree generation
As a side note, efficiently printing the tree is far more challenging.
I'd probably try a recursive approach where you first calculate all subtrees and their width to be able to design the actual tree.
But this wouldn't be as space efficient as your handmade diagram.
Cheers Rolf (addicted to the Perl Programming Language :) Wikisyntax for the Monastery FootballPerl is like chess, only without the dice