← Quiz: Design Search Autocomplete: all 10 questions
Quiz: Design Search Autocomplete · Question 1 of 10
Why store the top-k suggestions at every trie node?
Why store the top-k suggestions at every trie node?
- A.To save memory
- B.So a lookup only walks the prefix and returns a ready list, instead of searching the whole subtree
- C.Because tries cannot store full words
- D.To sort the alphabet
Answer & explanation
Correct answer: So a lookup only walks the prefix and returns a ready list, instead of searching the whole subtree
Precomputing the answer per prefix makes each lookup O(prefix length).
Can you get the rest right without peeking?
Take the timed Quiz: Design Search Autocomplete quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →