🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Design Search Autocomplete: all 10 questions

Quiz: Design Search Autocomplete · Question 9 of 10

What is the time to answer one lookup in a trie with top-k stored at each node?

What is the time to answer one lookup in a trie with top-k stored at each node?

  1. A.O(number of stored searches)
  2. B.O(length of the prefix)
  3. C.O(n log n)
  4. D.O(k × number of nodes)
Answer & explanation

Correct answer: O(length of the prefix)

Walk one node per typed character, then return the stored list.

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 →