Created
June 14, 2014 22:19
-
-
Save shosanna/0761d9b235ab39105759 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function naïve_string_search(kupka, jehla) { | |
for i ← 0 upto (kupka.length - jehla.length) { | |
j ← 0 | |
while (j < jehla.length && kupka[i + j] == jehla[j]) j += 1 | |
if j == jehla.length return i | |
} | |
return -1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment