Algorithms and Data Structures · Middle · Question 35 of 75

What is a trie good for?

Explanation

Each node represents a prefix and its children are the next characters. Checking a prefix costs O(length of the prefix), regardless of how many words are stored.

Further reading

Problem with a question

Algorithms and Data Structures · Middle · question 35

Test yourself

Take the Algorithms and Data Structures · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz