July 2018
Beginner
202 pages
5h 4m
English
The aim here is to develop a code in Java for implementing the Rabin-Karp algorithm for matching a string from a set of alphabetical characters that have decimal digits.
Perform the following steps:
long q = BigInteger.probablePrime(31, new Random()).longValue();// Precompute d^(m-1) % q for use when removing leading digitlong dm = 1;for (int i = 1; i <= m - 1; i++) dm = (d * dm) % q;// Precompute p and t0long ph = 0;long th = 0;for (int i = 0; i < m; i++) ...Read now
Unlock full access