Question: I'm trying to implement the rabin karp algorithm for pattern matching. But I keep getting segmentation fault in the rk_substring_match function.. Can someone help me

I'm trying to implement the rabin karp algorithm for pattern matching. But I keep getting segmentation fault in the rk_substring_match function.. Can someone help me and fix it for me please?

Ps. we have to do modulo arithmetic with the below functions. Please help!

#define PRIME 961748941 // calculate modulo addition, i.e. (a+b) % PRIME long long madd(long long a, long long b) { return (a + b) % PRIME; } // calculate modulo substraction, i.e. (a-b) % PRIME long long msub(long long a, long long b) { return (a>b)?(a-b):(a+PRIME-b); } // calculate modulo multiplication, i.e. (a*b) % PRIME long long mmul(long long a, long long b) { return (a*b) % PRIME; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!