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

No, it mutates the input trie. If you call `insert(trie, "foo")` with an empty trie, it will be modified to look like

  {'f': {'o': {'o': {END: True}}}}
I don't think this implementation is efficient enough to ever be worth using in a real program, though.


It probably works well enough for relatively simple problems, but the overhead of the dicts is definitely going to kill you memory-wise.




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

Search: