Bölüm 5 · SimülatörKMP Prefix Function & Z Algorithm? ← Bölüm 5 String Examples… ababcababd aabxaabxcaabxaabxay abacabadabacaba aaaaaaaaaa pattern$text with pattern Build ArraysPrefix function π and Z array (click a column)prefix s[0..k−1]matching blockposition iReady. KapatKMP Prefix Function & Z AlgorithmCompare two classic linear-time string preprocessing arrays on the same input.How to useType a string (at most 40 characters) or pick an example, then press Build Arrays (Enter also works).The table lists, for every index i, the character s[i], the prefix function value π[i] and the Z value Z[i]. Strings longer than 20 characters are split into two blocks.Click a column to see what its two values mean: the strips below highlight the prefix and the block of the string that match.Prefix function (π)π[i] is the length of the longest proper prefix of s[0..i] that is also a suffix. KMP uses it to continue matching after a mismatch without moving back in the text.Z arrayZ[i] is the longest prefix length matching the substring starting at i. By convention Z[0] is shown as 0. To search for a pattern P in a text T, compute Z on P + "$" + T: every position with Z[i] = |P| is a match.ComplexityArrayTimeMemoryPrefix function πO(n)O(n)Z arrayO(n)O(n)