06. Search Pattern (Rabin-Karp Algorithm)
The problem can be found at the following link: Question Link
My Approach
I suggest checking out this blog for a clear explanation of the Rabin-Karp Algorithm: Rabin-Karp Algo.
Time and Auxiliary Space Complexity
Time Complexity: Due to the use of hashing, the average time complexity is
O(n + m)
.Auxiliary Space Complexity: The auxiliary space complexity is
O(1)
since we only use a constant amount of extra space for storing variables and data structures.
Code (C++)
Contribution and Support
For discussions, questions, or doubts related to this solution, please visit our discussion section. We welcome your input and aim to foster a collaborative learning environment.
If you find this solution helpful, consider supporting us by giving a ⭐ star to the getlost01/gfg-potd repository.
Last updated