Content deleted Content added
→"Partial match" table (also known as "failure function"): Added complexity analysis considering also the inner loop |
→Efficiency of the table-building algorithm: Fixed some minor mistakes |
||
Line 433:
* The outer loop: <code>pos</code> is initialized to 1, the loop condition is <code>pos < k</code>, and <code>pos</code> is increased by 1 in every iteration of the loop. Thus the loop will take <math>k - 1</math> iterations.
* The inner loop: <code>
Combined, the outer and inner loops take at most <math>2k-2</math> iterations. This corresponds to <math>O(k)</math> time complexity using the [[Big O notation]].
|