🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.False, because no word ends at the node for "ca"
  2. B.True, because the path c-a exists
  3. C.An error, because "ca" is too short
  4. 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 →