Trie: The Tree Behind Autocomplete (and 3 Interview Questions That Use It)
Type app into a search box and the suggestions appear before you finish the keystroke. The dictionary behind that box might hold a million words, but the suggestions do not take a million steps — they take four, one per letter you typed. That is the whole trie: a tree where the path from the root is the word, so every operation costs the length of its argument and nothing else. No operation in this post depends on how many words are stored. ...