[Note] String summing up

Spicy chicken Knowledge


 

1. matching substring

  • Hash: Hash process and a substring value pattern string, then a bit match, $ O (n) $
  • KMP

2. Minimum cycle section

  • Submultiple enumerator, a hash value is determined for each segment are equal
  • KMP: If the string length $ len $, there is a circular section of the string if and only if $ len% (len-nxt [len]) == 0 && len / (len-nxt [len])> 1 $
  • How to understand: First $ nxt [] $ array represents the maximum length of the common prefix and suffix, then
  • Red is the longest common prefix and suffix, two shades of blue to the original alignment (he was definitely like myself)
  • Then we put the above string position moving about:
  • However, we found a common prefix and suffix is ​​matched:

  • so
  • He has been back on the OK match

3. The longest common prefixes and suffixes

  • Hash: enumerate each prefix and suffix, see the hash values ​​are equal
  • KMP: $ nxt [] $ array

4. palindromic longest substring

  • Hash: Enumeration each central palindrome, the palindrome binary string length.
  • manacher

recommended article:

Hash: https://www.cnblogs.com/jklover/p/10185164.html

Mañach: https://www.cnblogs.com/xiaoningmeng/p/5861154.html


2019.06.27 started

 

Guess you like

Origin www.cnblogs.com/Jackpei/p/11099197.html