I am learning about substring algorithms, esp Rabin Karp substring matching method from here and online sources. I see that for comparing longer substrings, we generally take the modulus.
- What are the characteristics of this K for the implementation to more effective?
- Why can't we compare String mod K as well as String div K for some K Why do we have to compare the entire string once a collision occurs? Isn't comparing the div and mod results going to be better than comparing the string?
- How do we modify the Rabin Karp Algorithm for String matching? Right now, I have implemented a method where each string is converted to it's ASCII value and stored in a Char Array. Is there a better way to do this?
- I undertsand how Inetegr.parseInt() is implemented and I see Java's String.Contains(). What algorithm is used in implementing this function?
Thank you!