Alex Rivera | Logout

Algorithms and Data Structures best suited for a spell checker, dictionary and a thesaurus

Asked 2009-10-06T08:21:31.877
11

Best way to implement a

  • dictionary (is there any DS better than Trie for Dictionary)
  • thesaurus (no idea, as match is made on meanings of the words, similar meanings)
  • spell checker (something better than a hash map), if possible with correct spelling recommendations.

When asked in a one hour interview, are we expected to write a c/c++ code, for the algorithm?

Edit
Report

1 Answer

1

For a dictionary I would use the std::map (calling Dictionary in the .Net framework) collection with the word as key and a custom object (with all information about the word + the definition) as value.

For a thesaurus the best structure is a tree where each node is a section and where each branch finished with an object which contains all information about what you have to display.

answered 2009-10-06T08:49:12.283

Your Answer