← Quiz: Tries (Prefix Trees): all 15 questions
Quiz: Tries (Prefix Trees) · Question 9 of 15
In "word search II" (find many dictionary words in a letter grid), why does a trie help?
In "word search II" (find many dictionary words in a letter grid), why does a trie help?
- A.The DFS can stop as soon as the current path is not a prefix of any word
- B.It sorts the grid
- C.It removes the need for DFS
- D.It makes every word the same length
Answer & explanation
Correct answer: The DFS can stop as soon as the current path is not a prefix of any word
Without a trie you would search for each word separately; with it, one DFS checks all words and prunes dead paths.
Can you get the rest right without peeking?
Take the timed Quiz: Tries (Prefix Trees) quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →