Created
June 17, 2016 02:04
-
-
Save 173210/ad85c548e693e134ef222fb633f25d2f 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
char *match(const char * restrict string, const char * restrict pattern) | |
{ | |
const char *pattern_cursor; | |
const char *string_cursor; | |
while (*string != 0) { | |
pattern_cursor = pattern; | |
string_cursor = string; | |
while (*string_cursor == *pattern_cursor) { | |
pattern_cursor++; | |
if (*pattern_cursor == 0) | |
return (char *)string; | |
string_cursor++; | |
} | |
string++; | |
} | |
return NULL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment