Update String_hashing.md

This commit is contained in:
Aakash Panchal 2020-06-03 22:50:01 +05:30 committed by GitHub
parent ded61868a1
commit 548a52570a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -183,6 +183,8 @@ $O(|p|)$ is required for calculating the hash of the pattern and $O(|s|)$ for co
You are given left($l$) and right($r$) indices of a substring, you are required to check whether the given substring is palindrome or not.
We will simply compare hashes of two half parts of substring $s[l,r]$. If hashes are same means that two half parts are same and substring is a palindrome.
If there are many queries of this type, then each query can be answered in $O(1)$, after $O(n)$ preprocessing.
```cpp