KMP算法精髓之预算NEXT值

void next_index(char *str, int next[]) {h
    int i = 0, j = -1, str_length = strlen(str);
    next[0] = -1;
    while(i < str_length) {
        if(j == -1 || str[i] == str[j] ) {
            ++i;
            ++j;
            next[i] = j;
        } else {
            j = next[j];
        }
    }
}

回复 (0)

› 尚无评论。

发表评论

允许使用的标签 - 您可以在评论中使用如下的 HTML 标签以及属性。

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

引用通告 (0)

› 尚无引用通告。