Skip to content

Instantly share code, notes, and snippets.

@173210
Created June 17, 2016 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 173210/ad85c548e693e134ef222fb633f25d2f to your computer and use it in GitHub Desktop.
Save 173210/ad85c548e693e134ef222fb633f25d2f to your computer and use it in GitHub Desktop.
時間的計算量を示しなさい。
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