3 ms·
for an excellent example of a trie implementation, the haskell bytestring trie datastructure is really nice to look at. Its docs can be found at http://hackage.
by carterschonwald 16y ago
for an excellent example of a trie implementation, the haskell bytestring trie datastructure is really nice to look at. Its docs can be found at http://hackage.haskell.org/package/bytestring-trie http://hackage.haskell.org/package/bytestring-trie and the very readable sourcecode at http://hackage.haskell.org/packages/archive/bytestring-trie/0.2.2/doc/html/src/Data-Trie-Internal.html http://hackage.haskell.org/packages/archive/bytestring-trie/...
edit: note that its not strictly a trie, but can be used as one, in general its more like it does a trie-like key value lookup.
edit: it is also worth noting that its pretty fast, counting reading data in from the file system and other overhead, loading 1.5 million key - value pairs of realworld production data into the trie, and then making my first query, in under 30 seconds. And thats without even doing the sort of preprocessing that can make it much much faster! (namely, lexigraphically sorting the strings I'm using as keys before doing the k-v insertions)