Trie
A tree built for prefixes — autocomplete, dictionaries, and searching many words at once.
This topic is part of Pro.
Free covers the C and Python courses, the first three DSA topics, the opening system design lessons and the beginner AI lessons, all with the full coach. Pro opens the rest of the library in the FollowtheDamnCode app.
What is in it
- 1How tries workInsert, search, and startsWith by walking one character at a time, with an end-of-word flag. Pro
- 2Prefix queriesShortest root, autocomplete, and longest common prefix — answers that fall out of walking the trie. Pro
- 3Searching many words at onceWalk a grid and the trie together, pruning any path that isn't a prefix of some word. Pro