title: Optimal Compare Algorithm for finding string matches in List of strings C#
body: <p>Say I have a list of 100,000 words.  I want to find out if a given string matches any words in that list, and I want to do it in the fastest way possible.  Also I want to know if any other words, that are formed by starting with the first character, in that string appear in the list.</p>
  
  <p>For example:</p>
  
  <p>Say you have the string "icedtgg"</p>
  
  <p>"i"
  "ic"
  "ice"
  "iced"
  "icedt"
  "icedtg"
  "icedtgg"</p>
  
  <p>I am trying to come up with an optimal compare algorithm that tells me if the following words are in my list.</p>
  
  <p>What I have so far is my list of 100,000 words are stored in a</p>
  
  <pre><code>Dicitonary&lt;char, List&lt;string&gt;&gt; WordList;
  </code></pre>
  
  <p>where <code>char</code> is the first character of the word, and the <code>List&lt;string&gt;</code> is all of the words that start with that character.</p>
  
  <p>So <code>WordList['a']</code>
  has a list of all words that start with 'a' ("ape", "apple", "art" etc.) and 'b' has a list of all words that start with b etc.</p>
  
  <p>Since I know that all of my words start with 'i', I can first narrow my solution down from 100,000 words to just the words that start with 'i'.</p>
  
  <pre><code>List&lt;string&gt; CurrentWordList = WordList['i'];
  </code></pre>
  
  <p>Now I check</p>
  
  <pre><code>if( CurrentWordList[0].Length == 1 )
  </code></pre>
  
  <p>Then I know my first string is a match "i" because "i" will be the first word im the list. These lists are sorted alphabetically beforehand, so as not to slow down the matching.</p>
  
  <p>Any ideas?</p>
  
  <p>*No this is not a HW assigment, I am a profesionall Software Architect trying to find an optimal match algorithm for fun/hobby/game development.</p>