Algorithms and Data Structures · Senior · Question 43 of 75

Which approach answers "is this word in the dictionary?" for millions of words with the least memory, if rare false positives are fine?

Explanation

A Bloom filter needs about 10 bits per word for a 1% false positive rate, regardless of word length. A trie or a sorted array stores the words themselves, which takes far more memory.

Further reading

Problem with a question

Algorithms and Data Structures · Senior · question 43

Test yourself

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

Take this quiz