title: Fastest way find the edit Distance of a word, given a list of Million words
body: <p>I have a file with more than a million words, one word in each line. I am trying to write code where if I were given a word I need to find out if that word is present in the file. The thing here is, each word has to be checked for <code>26^(word.length()-1)</code> times. Hence, going through every word in the file is not a good solution. I tried finding algorithms online but not have found any appreciable answer yet. </p>
  
  <p><strong>EDIT</strong>
  I have thought about both a <code>HashMap</code> and <code>Trie</code>. The actual problem here is say I have the word <code>abc</code>. Now, my task is to add, remove, or substitute exactly one letter in word <code>abc</code> to create word X and then check if X is in the file. Hence am confused as to which solution might be a better approach.</p>