Brute-Force String Matching
Brute-Force String Matching
Brute-force string matching compares a given pattern with all substrings of a given text. Those comparisons between substring and pattern proceed character by character unless a mismatch is found. Whenever a mismatch is found, the remaining character comparisons for that substring are dropped and the next substring can be selected immediately. The visualization of this sliding selection window shows the selected characters in blue. The characters which are currently compared are printed in magenta. Note that brute-force searching usually involves automatic shifts upon mismatch to avoid unnecessary comparisons.