title: What is the Time Complexity, Space complexity and Algorithm for strstr() function in C++?
body: <p>I was curious about the cost of using the default, old fashioned strstr() function in C++. What is its Time and Space complexity? Which algorithm does it use? 
  We have other algorithms with below Worst Case Time and Space complexity :
  Let n = length of string, m = length of pattern</p>
  
  <ol>
  <li>Knuth-Morris-Pratt Algorithm : Time = O(n+m), Space = O(m)</li>
  <li>Rabin-Karp Algorithm         : Time = O(n*m), Space = O(p) (p = p patterns of combined length m)</li>
  <li>Boyer-Moore Algorithm        : Time = O(n*m), Space = O(S) (S = size of character set)
  In any way strstr() is better than above mentioned algorithms, in terms of Time and Space complexities?</li>
  </ol>