PATRICIA

Wednesday, 4 June 2008.


If you've never run across them before, PATRICIA trees are a ridiculously space-and-time efficient data structure for implementing a dictionary: they take less space than a dense array (achieved by clever key storage) and are as fast as a hash table. The only reason I can see that they're not more commonly used is because they lack versatility: they require their keys to be strings.

I was playing with them as the storage engine for a distributed hash-table type system; unfortunately, I could not find a C library that did what I wanted. So… I wrote one myself! And I'm hereby releasing it into the public domain for anyone to play with. (Please do so at your own risk: I will not be responsible for the code taking control of your computer and causing it to eat babies.)

The library was designed with speed-efficiency in mind; to that end, all methods are iterative. However, there is still a lot of room for improvement:

If you feel the need to hack on it, please, let me know what revisions you've made: I would love to include them!

Lavender, the Lonely Pink Elephant