• 0

Data structure Help


Question

I am trying to create a algorithm thats similar to the dictionary function found in phones, basically, you type the first letter in, and a suggested word comes out, and as you type in more letters in, the dictionary algorithm, look for the best match based on the current letters avaliable. What type of data strucutre should I use ? I am thinking of using a hashmap and the first letter of the words as the key to the hashmap. Is there a better data structure that I could use.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

as a data structure you may want to look along the lines of a tree

one where every node has 26(more or less) branches

Link to comment
Share on other sites

  • 0
as a data structure you may want to look along the lines of a tree

one where every node has 26(more or less) branches

Yeah, trees would be the most efficient way, although they do take up more memory due to the nodes.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.