Suffix Array notes

Source: Internet
Author: User

These two concepts are frequently seen in string matching issues:

Text: Original

Template (pattern): keyword (equivalent to a substring)

Task: Find pattern in text

Common algorithms:

AC Automata: Multiple pattern

KMP: Known pattern, preprocessing of pattern

Trie: Also known as a prefix tree, often used to find string prefixes

Suffix array: Known text, preprocessing of text

Suffix tree: In fact, the path is compressed version of the trie tree, the tree does not have a forked path compressed

-----------------------------------------------------------------

Sa[i]: suffix array, all suffixes of the pattern are sorted from small to large, and the beginning position of the first suffix (total n suffixes, sa[0..n-1]) is ordered.

Eg: for the word "banana", sa={5,3,1,0,4,2}, respectively, corresponding to the suffix A, ana, Anana, Banana, NA, nana

Rank[i]: Save Sa[i] rank from small to large in all suffixes

Sa[i] and rank[i] reciprocal, namely sa[rank[i]]=i, rank[sa[i]]=i

Defines the longest common prefix length for height[i]=sa[i-1] and Sa[i] (that is, the longest common prefix length for two ranked adjacent suffixes)

Suffix Array notes

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.