[Solved]Karp Rabin Computation Unoptimized Failure Function Optimized Failure Function String Abra Q37083083
![unoptimized failO11 1212123 14 optimized faili] 00 2 02011 1 Optimized finite state machine and failure function for the stri](https://media.cheggcdn.com/media%2F399%2F399eea01-e827-46db-af1b-652b7d64c19d%2Fphp9qHCkQ.png)
![COMPUTEFAILURE(P[1.. m1): for i ← 1 to m fail[i] ← j (*) while j > 0 and P i] P[ j] j-fail[j] j←j+1](https://media.cheggcdn.com/media%2F0ab%2F0abc8ad2-8d80-48b0-ba3d-72ca2e00342f%2Fphpj5p3Be.png)
![OPTIMIZEFAILURE(PI1.. ml, failí1 .. m): for l ← 2 to m if P[i-P[fail[i]] failli]faill fail[i]] the optimized failure function](https://media.cheggcdn.com/media%2F4e3%2F4e37c133-9ee4-4638-9c8d-0ce5ef3074ff%2Fphp57VcEU.png)
This is Karp-Rabin computation of an unoptimized failure functionand an optimized failure function for the string:ABRACADABRA.
Can someone explain step by step how the calculations are done?
unoptimized failO11 1212123 14 optimized faili] 00 2 02011 1 Optimized finite state machine and failure function for the string ‘ABRADACABRA COMPUTEFAILURE(P[1.. m1): for i ← 1 to m fail[i] ← j (*) while j > 0 and P i] P[ j] j-fail[j] j←j+1 OPTIMIZEFAILURE(PI1.. ml, failí1 .. m): for l ← 2 to m if P[i-P[fail[i]] failli]faill fail[i]] the optimized failure function directly by adding three new lines (in bold) URE function COMPUTEOPTFAILU RE P1..m): for l ← 1 to m if P[i]=P[j] fail[i] ← fail[j] else fail[i] ← j while j 〉 0 and P[i] P[j] fail[j] ← tau j←j+1 Show transcribed image text unoptimized failO11 1212123 14 optimized faili] 00 2 02011 1 Optimized finite state machine and failure function for the string ‘ABRADACABRA
COMPUTEFAILURE(P[1.. m1): for i ← 1 to m fail[i] ← j (*) while j > 0 and P i] P[ j] j-fail[j] j←j+1
OPTIMIZEFAILURE(PI1.. ml, failí1 .. m): for l ← 2 to m if P[i-P[fail[i]] failli]faill fail[i]] the optimized failure function directly by adding three new lines (in bold) URE function COMPUTEOPTFAILU RE P1..m): for l ← 1 to m if P[i]=P[j] fail[i] ← fail[j] else fail[i] ← j while j 〉 0 and P[i] P[j] fail[j] ← tau j←j+1
Expert Answer
Answer to This is Karp-Rabin computation of an unoptimized failure function and an optimized failure function for the string: ABRA… . . .
OR

