Yes you're right, there's a lot of code to go with this, about 1400 lines.
The reason I'm using an array, is based on command line options I'm passing in, I'm creating either a hex tree or a binary tree. I'm doing this becuase I'm using perl to get stats on the tree (as in the number of bits per prefix and such) for a piece of hardware we are putting a similar data structure in. This is basically our model, for the limiting case.
Now as you may imagine, with this comes the idea that processing it takes a while. I've gotten it down to about 13 minutes on a dataset of 90,000+ records, using recursive calls and storing more data in nodes. If I were to add an isLeaf member function, I would have the cpu overhead of a function call every time I wanted to use that. I may switch it to 1/0, but doesn't that get rounded up to a 64-bit integer?
I'm not seeing much space saved there.
Thanks for the reply.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.