Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They can eat memory at extraordinary rates, but I've successfully used them to reduce memory usage as well. If you need to store a mess of strings that tend to have a lot of duplication toward the front - URIs, for example - then a trie might fare pretty well in that department.


A DAWG can be even better, at the expense of considerable setup cost.

Though a naive Trie can be converted to a DAWG incrementally and on-the-fly relatively easily. If you're careful, you can even do this on another thread in the background.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: