- 27
- 0
- 约 45页
- 2016-12-04 发布于江苏
- 举报
* Example 8String match with wildcards bool match (char *w, char *s) { int i, j; for (i = 0; i strlen(w); i++) for (j = 0; j strlen(s); j++) m[i][j] = false; m[0][0] = true; for(i = 1; i = strlen(w); i++) for(j = 0; j = strlen(s); j++) if (w[i-1] == ‘*’) m[i][j] = (!j) ? (m[i-1][j]) : (m[i][j-1] || m[i-1][j]); else if (j) { if (w[i-1] == ‘?’) m[i][j] = m[i-1][j-1]; else m[i][j] = m[i-1][j-1] (w[i-1] == s[j-1]); } return m[strlen(w)][strlen(s)]; } Example 9: All-Pairs S
原创力文档

文档评论(0)