Blog

Your dream job? Lets Git IT.
Interactive technical interview preparation platform designed for modern developers.

XGitHub

Platform

  • Categories

Resources

  • Blog
  • About the app
  • FAQ
  • Feedback

Legal

  • Privacy Policy
  • Terms of Service

© 2025 LetsGit.IT. All rights reserved.

LetsGit.IT/Categories/Algorithms
Algorithmsmedium

Rabin–Karp: what is a rolling hash and what is the main caveat?

Tags
#string#hashing#rabin-karp#rolling-hash
Back to categoryPractice quiz

Answer

A rolling hash lets you update the hash of a window when you shift by one character (remove left, add right). Rabin–Karp compares hashes to find candidate matches, then usually verifies the substring to avoid false positives. Caveat: hashes can collide, so without verification it’s not guaranteed correct.

Related questions

Algorithms
KMP string search: how does the LPS/prefix table avoid re-checking characters?
#kmp#string#pattern-matching
Java
StringBuilder vs StringBuffer: what’s the difference?
#java#string#performance
Data Structures
What is a Bloom filter and what trade-off does it make?
#bloom-filter#probabilistic#hashing
Data Structures
Cuckoo hashing: what is it and what trade-off does it make?
#hashing#cuckoo-hashing#hash-table
Data Structures
What is a rope (string rope) and why would you use it?
#rope#string#data-structure