JJTO
JJTO

Reputation: 897

BST or hash table dictionary for a spelling checker

If I were to implement a word processor's spelling checker, which would be more efficient implementation? The dictionary needs frequent retrievals and occasional insertions. Since there is no maximum number of dictionary items, BST would be a better choice. But it also needs frequent retrievals and a hash table has faster search operation time. What would be the better answer in this case?

Upvotes: 0

Views: 391

Answers (1)

Saurav Sahu
Saurav Sahu

Reputation: 13994

Since there is no maximum number of dictionary items, BST would be a better choice.

IMO, implementing a dictionary using BST would be a bad idea. Trie is the right option for you.

You can find the comparision between hashtable and trie here : How Do I Choose Between a Hash Table and a Trie (Prefix Tree)?

Upvotes: 1

Related Questions