naively computing the hash value for the substring codice_2 requires o("m") time because each character is examined. since the hash computation is done on each loop, the algorithm with a naïve hash computation requires o(mn) time, the same complexity as a straightforward string matching algorithms. for speed, the hash must be computed in constant time. the trick is the variable codice_3 already contains the previous hash value of codice_4. if that value can be used to compute the next hash value in constant time, then computing successive hash values will be fast.