title: Which algorithm is better, Z-algo or KMP-algo for pattern search?
body: <p>Time complexity for both the algorithms is O(m+n).</p>
  
  <p>n and m being the lengths of the text and the pattern to be searched.</p>
  
  <p>The space complexity for Z algo is O(m+n) and the space complexity for the KMP algo is O(n).</p>
  
  <p>I want to know which algorithm is practically faster and which one should be used generally ?</p>