Horspool and BM Algorithm analysis

Source: Internet
Author: User

Recently, the algorithm has learned the HORSPOOL,KMP,BM three kinds of algorithms. Let's make a share.

Horspool algorithm:

Algorithm ideas: 1. Divided into matching strings, the original string

2. Match from right to left: Once a mismatch is encountered, the original string moves table[i] characters relative to the matched string
3.table[] by the original string each word Fusso to the original string each word typeface to match the string to the right of the distance

Movement rule:

T (c) = {The length of the pattern m (if C is not included in the first m-1 characters of the pattern)

The distance from the rightmost C to the last character in the pattern before m-1 (other cases)

Horspool and BM Algorithm analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.