1. Binary Search of ordered Series
The simplest and purest problem of binary lookup is that if we use a circular method, the score will be higher.
2. Search for the first character that appears twice
For example:The first string that appears twice in the string "yactysa" is 'y'
Solution 1:O (N ^ 2) efficiency. That is, the simplest dual-loop.
Solution 2:It is better to use more hash methods. Define an array of 256.
3. Search for the "your" sub-string among multiple strings and sort them by the number of occurrences
Detailed question: a text input is provided. All rows containing the sub-string "your" must be output, regardless of case. In addition, the row is output in ascending order of the number of times your appears.
The KMP algorithm is easy to think of when dealing with substrings. However, every letter in "your" is unique, so you can simplify the judgment. If there are different characters, you can directly compare the current position with the character whose substring subscript is 0.
Where to answer questions 2015-R & D