...continua...
" It's a shame that apparently "trie" is the usual name of that data
structure, because it's not a true name, and nobody knows how to
pronounce it (like "tree" or "try"?).
The common "Radix tree" is better imho.
But I'm far from being a tree specialist, so you will tell me.
The interface seems perfect. It's just the name "Trie" that I find ugly. :-)
Another point on the implementation: you should not use malloc(), free()
and realloc(), but the functions provided by the interpreter API, i.e.
GB.Alloc(), GB.Free() and GB.Realloc().
They are usually faster, especially if you allocate small chunks of data.
Moreover, they can detect memory leaks by checking that every allocation
has been freed at the end of the program.
If you can compare with malloc() easily, don't hesitate not to trust me and check. :-)
--
Benoît Minisini "
" I pronounce it like "try". RadixTree or PrefixTree would be options for the
container -- nothing against that -- but what about the other class?
RadixTreePrefix or even PrefixTreePrefix? :-) Naming it Patricia (from the
acronym) would be fun but even more confusing, right?
The trie.c and trie.h are from another library I wrote. (That's why I
double-tested the projects with valgrind.) It should not be a problem
to convert the uses of malloc()/free() now.
Regards,
Tobi "