My favourite data structure: The trie
Published on
January 16, 2024
under the Coding category. Toggle Memex mode
Suppose you want to build a predictive text engine. Given a few letters, you want to predict the end of a word. Suppose we have the string "co". The next word could be:
Cobalt
Code
Coffee
Co-operate
Or many other words.
Given a dictionary of all words in the English language, you could find all the words that start with "co" and pick one to recommend. But how would you pick one to recommend?
A good answer to this is to us...
Read more at jamesg.blog