Skip to content

Update 15-《进阶》KMP算法与bfprt算法.md #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 15-《进阶》KMP算法与bfprt算法.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

==注意前后缀长度不可取k位置前的整体长度6。那么此时k位置前的最大匹配长度为3==

所以,例如"aaaaaab","b"的指标为6,那么"b"坐标前的前后缀最大匹配长度为5
所以,例如"aaaaaab","b"的坐标为6,那么"b"坐标前的前后缀最大匹配长度为5


我们对match建立坐标前后缀最大匹配长度数组,概念不存在的设置为-1,例如0位置前没有字符串,就为-1,1位置前只有一个字符,前后缀无法取和坐标前字符串相等,规定为0。例如"aabaabc",nextArr[]为[-1,0,1,0,1,2,3]
Expand Down