Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bfa6f96

Browse files
minhazmirazjakobkogler
authored andcommitted
Fixing typo (#427)
1 parent 899109e commit bfa6f96

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/string/string-hashing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The following condition has to hold: if two strings $s$ and $t$ are equal ($s =
1616
Otherwise we will not be able to compare strings.
1717

1818
Notice, the opposite direction doesn't have to hold.
19-
It the hashes are equal ($\text{hash}(s) = \text{hash}(t)$), then the strings do not necessarily have to be equal.
19+
If the hashes are equal ($\text{hash}(s) = \text{hash}(t)$), then the strings do not necessarily have to be equal.
2020
E.g. a valid hash function would be simply $\text{hash}(s) = 0$ for each $s$.
2121
Now, this is just a stupid example, because this function will be completely useless, but it is a valid hash function.
2222
The reason why the opposite direction doesn't have to hold, if because there are exponential many strings.
@@ -185,7 +185,7 @@ But notice, that we only did one comparison.
185185
What if we compared a string $s$ with $10^6$ different strings.
186186
The probability that the at least one collision happens is now $\approx 10^{-3}$.
187187
And if we want to compare $10^6$ different strings with each other (e.g. by counting how many unique strings exists), then the probability of at least one collision happening is already $\approx 1$.
188-
It is pretty much guaranteed that this task will end will a collision and returns the wrong result.
188+
It is pretty much guaranteed that this task will end with a collision and returns the wrong result.
189189
190190
There is a really easy trick to get better probabilities.
191191
We can just compute two different hashes for each string (by using two different $p$, and/or different $m$, and compare these pairs instead.

0 commit comments

Comments
 (0)