title: When to use Rabin-Karp or KMP algorithms?
body: <p>I have generated an string using the following alphabet.
  <code>{A,C,G,T}</code>. And my string contains more than 10000 characters. I'm searching the following patterns in it.</p>
  
  <ul>
  <li>ATGGA  </li>
  <li>TGGAC</li>
  <li>CCGT</li>
  </ul>
  
  <p>I have asked to use a string matching algorithm which has <code>O(m+n)</code> running time. </p>
  
  <pre><code>m = pattern length
  n = text length
  </code></pre>
  
  <p>Both <code>KMP and Rabin-Karp algorithms</code> have this running time. What is the most suitable algorithm (between Rabin-Carp and KMP) in this situation?</p>