For every typed text the server must find, within microseconds, the 5 most popular queries that start with it. It cannot go through the queries to do that: under one letter there are hundreds of thousands. This lesson is about a structure in which the answer for any prefix already lies ready, and about how to build it. We work it all by hand on six queries.
In this lesson
- The prefix tree
- A lookup with no ready answers
- Ready answers in the nodes
- Why ten, not five
- Where to keep the trie
- Common mistake
- Key points