计算下列next数组1.aabaabbbab 2.xyxxyyx 3.ababaaababaa 4.abcabcabc 5.aaab
时间: 2024-05-24 12:10:41 浏览: 227
4.2_3_求next数组 (2)1
1. aabaabbbab的next数组为:[-1, 0, 1, 0, 1, 2, 0, 1, 2, 0]
2. xyxxyyx的next数组为:[-1, 0, -1, 0, -1, 0, -1]
3. ababaaababaa的next数组为:[-1, 0, 0, 1, 2, 0, 1, 2, 3, 4, 5, 3]
4. abcabcabc的next数组为:[-1, 0, 0, 1, 2, 3, 4, 5, 6, 7]
5. aaab的next数组为:[-1, 0, 1, 2]
阅读全文