DDSA Solutions

Rolling Hash

5 problems

Rolling hash computes a new hash from the previous one in O(1) by removing the outgoing character and adding the incoming one. Used in Rabin-Karp string matching and detecting duplicate substrings. Choose a large prime modulus and base to minimize collisions.