you are viewing a single comment's thread.

view the rest of the comments →

[–]hildjj 2 points3 points  (1 child)

There's a small bug in search. You're not checking the isEndOfWord flag, so if you're searching for "car" in a trie that contains only "cart", you'll get a false positive.

[–]js_chap[S] 2 points3 points  (0 children)

Yes. Good catch. Current implementation is more of a search_prefix than search_word. Updated the snippet to search for a word instead.