Trie Insert
Walk existing character edges, create the missing ones, and mark the final node terminal.
Trie: Insert words sharing prefixes
End of "car": mark this node terminal. Without the mark, a word that is only a prefix of another, or a prefix that is not a word, could not be told apart.
Cost
- Best
- O(L)
- Average
- O(L)
- Worst
- O(L)
- Space
- O(L)
Before this
Related
Leads to
Topics that need this one first.
Taught by the same lesson
Trie covers these too, in the same run.