[Tutor] treeTraversal, nested return?

jjcrump at uw.edu jjcrump at uw.edu
Sat Jun 5 03:40:10 CEST 2010


Matthew,

sorry for responding to you instead of the list

Thanks for trying to tutor the dunderheaded. It is exactly the general 
solution I wish to learn. But how, in the context of my treeTraversal 
function, does one "keep track of the depth you're at"? Tabs are all very 
well, but what I want is truly a nested structure, and as you point out in 
<nitpick> that's not what I was showing in my html (though deprecated, 
browsers still render lists like the one I showed).

The simplest and most graphic example would be a nested list of lists, but 
for the life of me I can't work out how to generate that in this context.

Jon



On Fri, 4 Jun 2010, Matthew Wood wrote:

> In general, there's 2 solutions to your "unflattening" problem.
> A) The general solution: Keep track of the depth you're at, and add 
tabs/spaces ('\t' * depth) as necessary.





More information about the Tutor mailing list