Tries and typeahead
A user types 'how t' and, before they type the next letter, sees 'how to tie a tie'. Suggestions must appear within about a hundred milliseconds of the user pausing, from billions of past searches. What structure makes that possible?
In this lesson you'll learn to
- Explain how a trie stores strings by shared prefixes, and how fast a prefix lookup is.
- Return the most popular completions fast by storing the top k at each node.
- Build suggestions offline from query logs, and update them on a schedule.
- Serve typeahead at scale with in-memory tries, sharding, caching and client debouncing.
Create a free account to open this lesson
It's free. You'll get every free lesson, quizzes that save your progress, daily flashcards and streaks.