问答题

使用KMP算法求出模式p=”aabcaabbaa”的优化后的next数组。注意:只列出数字,数字之间用一个空格分隔。比如:0 0 0 0 0 0 0 0 0 0
Use KMP algorithm to derive the optimized "next" array for the pattern p = "aabcaabbaa".
Note: Write down the numbers in the next array separated by single space.
For example: 0 0 0 0 0 0 0 0 0 0

【参考答案】

-1 -1 1 0 -1 -1 1 3 -1 -1