How a trie stores words, and finds every word that starts with ca
How a trie stores words, and finds every word that starts with ca
Words that start alike share one path.
A trie stores words one letter at a time. Car, cat, cart and care all walk over the same c and a, so eight words with 25 letters fit in 11 tiles. To find every word starting with “ca”, walk down two tiles and take everything below.
Save it for the next time you build a search box.
#trie #datastructures #computerscience #coding #programming