I was assuming that greater values went to the right and lesser to the left (as all the pictures of sample trees in the book showed). Also made this assumtion when learning trees in one of my Data structure courses - and thats the order we built them. But as Grandfather says, either way would be ok as its hidden from the user.

I did build a tree just now (using the code from the book), and reversed the order to put greater values to the right and Data::Dumper showed me the structure I was looking for. Thanks for the tip on the Tree modules, Dragonchild. I'll give them a closer look tomorrow. If I do need to use them I will consider looking at these modules. I imagine being written in C, it may be faster and they have many features. However, I'm trying to re-learn what I had in school 8 years ago (water under the bridge :-)   ).

Thanks for the input everyone.


In reply to Re: Basic tree - compare question by Cristoforo
in thread Basic tree - compare question by Cristoforo

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.