Strings are a finite sequence of 0 or more characters, the Nether teaches strings. It is generally remembered as a = "aaaaaa"; the number of characters in a string n is called the length of a string. A string of 0 characters is called an empty string.
A space string is a string that contains only spaces. The space string has a length of content. A subsequence of any number of consecutive characters in a string is called a substring of that string. The string containing the substring is called the main string. The position of the substring in the live string is the ordinal number of the first character of the substring in the main string. Strings can be compared in size. The comparison of strings is by the encoding of strings between the characters. This is the ASCII code. The locating operation of a substring is often called a pattern match of a string. KMP Pattern matching algorithm. Simple to understand. Compare if there is a B string in a string. Match to find a string equal to the string B character. If unsuccessful at the end of this match, the distance between this character in a string and the middle of the matching failure character does not need to be traversed. When you have the same character in a string, you need to take into account an array of next. The array that stores the subscript difference value for the same character. ABCABX when n = 1 o'clock, next[1] = 0;n = 2 o'clock, next[2] = 1;n = 3 o'clock, next[3] = 1;n = 4 o'clock, next[4] = 1;n = 5 o'clock, store the first 4 characters in a string, prefix character equals suffix character, prefix character and suffix The middle of the character contains two characters, so next[5] = 2; the previous difference may also be one of the same small string with the distance of the small string n = 6 o'clock, because the prefix character is equal to the preceding character of the prefix character and the suffix character and the suffix character, so the difference is +1,next[6] = 3; This algorithm needs to open a single chapter detailed understanding.
"Big Talk Data Structure"---fifth chapter string