LearnFrenzy
Sign in Take a free test

Data Structures in Java · Data Structures in Java MCQ · Question 15

Cost of looking up a word in a trie Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 15 Back to Exercise

A trie holds n words. What is the cost of checking whether a word of length L is present?

  • A O(n)
  • B O(log n)
  • C O(L) Correct
  • D O(n × L)
Correct Answer: Option C

The search follows one child per character, regardless of how many words are stored.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links