Menu

[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
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

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


Leave a Reply

Your email address will not be published. Required fields are marked *