title: Big O Notation for string matching algo
body: <p>What would the big O notation of the function foo be?</p>
  
  <pre><code>int foo(char *s1, char *s2)
  {
     int c=0, s, p, found;
     for (s=0; s1[s] != '\0'; s++)
     {
        for (p=0, found=0; s2[p] != '\0'; p++)
        {
           if (s2[p] == s1[s])
           {
              found = 1;
              break;
           }
        }
        if (!found) c++;
     }
     return c;
  }
  </code></pre>
  
  <p>What is the efficiency of the function foo?</p>
  
  <p>a) O(n!)</p>
  
  <p>b) O(n^2)</p>
  
  <p>c) O(n lg(base2) n )</p>
  
  <p>d) O(n)</p>
  
  <p>I would have said O(MN)...?</p>