|
|
|
|
|
by light_hue_1
1157 days ago
|
|
It's not at all like the trie solution!
Not in performance and certainly not in terms of complexity. A trie is a pretty nasty datastructure memory wise. It involves chasing pointers all over the place. The constants on a trie are not going to be very good. For an incremental hash, you hash your string, and then you fix your hash up as you go. Then you look up your hash in a hash table. Code-wise it's far simpler to implement. And performance wise it will be far faster! The two solutions have nothing to do with one another. Except that they're both O(n). |
|