On (15 Jun 97) Neil Burrows wrote to Jerry Coffin...
JC> This is still fairly easy to handle as a rule. Load the data
JC> into memory in an array, then create your binary tree out of the
JC> data recursively.
NB> This is true, however it is not the most efficient of methods, as you
NB> will have two copies of every word in memory at the end.
Not necessarily. Assuming your nodes contain pointers to the actual
data, you can simply point them at the data in the array instead of to
individually allocated structs. However, you do have to be a bit
careful about deleting objects from the tree if you do this, as you
can't simply free() one item in the array without causing problems. You
can usually work around this by simply marking items as deleted instead
of freeing them, at least if they're in the original array. This
usually means using a byte or so for bookeeping.
Later,
Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)
|