Aho Corasick algorithm

后端 未结 2 749
北荒
北荒 2020-12-30 14:45

I am not able to understand the below algorithm which is used for string pattern matching using Aho-Corasick alg.

Procedure AC(y,n,q0)
INPUT: y<-array of          


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-30 15:46

    You probably won't gain a good understanding of the Aho-Corasick algorithm from reading a little bit of pseudocode. Unless you understand the state transition table, the algorithm will make no sense at all.

    There's a decent explanation along with an animation at Aho-Corasick implementation and animation.

    The original paper, Efficient String Matching: An Aid to Bibliographic Search(PDF), is well written and understandable, and the pseudocode examples are pretty easy to convert to working code. It'll take a little study, but you should have a good understanding after you read the paper, think about it a bit, and then read it again.

提交回复
热议问题