It's not as easy as saying "Can you traverse this or not?"
Of course it is! All of the relationships between the nodes are present and accounted for. Printing this out, I've explained this to two nonprogrammers; they recognize the pattern after a walkthrough, and given a much more complex example than the one I posted can easily traverse it. I've explained it to programmers and they can recognize the pattern and have so far failed to be able to write code to do it -- including me.

suspect that traversal isn't the only thing you're planning on doing
No, it's not. In fact, there's a whole ad-hoc report generation system which uses the "output" of this problem to produce reports. Sorts, breaks, totals, summary, detail, etc... The earlier incarnations of this routine suffered from bugs which caused either duplicate traversals or missed traversals in some very odd places.
In addition, you still haven't fully laid out the rules for the traversal.
That's because every time I try to quantify it, it breaks down at some level or another. Step 4.5 (which everyone seems to grasp intuitively, but not be able to describe) is "only after each child, once we've fully descended into the tree do we have a complete record; on the next child, the nodes descended by the first have to be thrown away and re-done". Sort of. But that's not clean enough to code and may not be entirely accurate.

I have much, much larger examples that aren't nearly so neat and tidy if necessary. They all follow this pattern though.


In reply to Re: Re: Re: Re: So you think you're good with structures? by clintp
in thread So you think you're good with structures? by clintp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.