Rabin-Karp algorithm uses _______ to efficiently find the occurrence of a pattern within a text.

  • Binary search
  • Greedy approach
  • Hashing
  • Sorting
The Rabin-Karp algorithm uses hashing to efficiently find the occurrence of a pattern within a text. It employs a rolling hash function that allows the algorithm to compute the hash value of the next substring in constant time, making it suitable for fast pattern matching.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *