Z-Algorithm

Ruth Williams, 1984

O(n)

The Z-algorithm maintains a window [l,r] so prior Z values accelerate matching when the string aligns with its own prefix (as in linear-time pattern search). On the short string 'aabxaab', the canvas shows index rows, the extending match at i, the Z-box interval, and the Z table filling in the museum palette; Gusfield's exposition (1984) is the usual reference.