KMP - Knuth Morris Pratt - String Matching Algorithm Code

why you have set j = reset[j]; at line no. 31 in the code video of kmp

1 Like

my doubt is this , j should be equal to zero and not reset[j] which is -1 ;

In the very beginning, we had j=-1.
Why?
The reason is same

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.