KMP understanding

KMP algorithm to solve the problem: optimize the BF (Brute Force) algorithm, avoid backtracking matching of the main string (matching unsuccessful n-1), and the efficiency is low.

KMP algorithm principle/purpose: The main string does not backtrack, that is, the matching pointer points to the mismatch position, and is moved by the substring/pattern string, and the string matching is completed by this pattern.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326661537&siteId=291194637