3 ms·
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
by juki 5y ago
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.
- masklinn 5y agoIt probably works well enough for relatively simple problems, but the overhead of the dicts is definitely going to kill you memory-wise.