← Quiz: Tries (Prefix Trees): all 15 questions
Quiz: Tries (Prefix Trees) · Question 3 of 15
Words cat, car and cart are stored. What does search("ca") return?
Words cat, car and cart are stored. What does search("ca") return?
- A.False, because no word ends at the node for "ca"
- B.True, because the path c-a exists
- C.An error, because "ca" is too short
- D.True, because three words start with "ca"
Answer & explanation
Correct answer: False, because no word ends at the node for "ca"
starts_with("ca") would be True, but search needs the end flag.
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 →