Algorytm Aho Corasicka

Nie jestem w stanie zrozumieć poniższego algorytmu, który jest używany do dopasowywania wzorców strun za pomocą Aho-Corasick alg.

Procedure AC(y,n,q0)
INPUT: y<-array of m bytes representing the text input
(SQL Query Statement)
n<-integer representing the text length
(SQL Query Length)
q0<-initial state (first character in pattern)
2: State <-q0
3: For i = 1 to n do
4: While g ( State, y[i] = = fail) do
5: State ← f (State)
6: End While
7: State ← g(State,.y[i])
8: If o(State)  then
9: Output i
10: Else
11: Output
12: End If
13: End for
14: End Procedure

questionAnswers(2)

yourAnswerToTheQuestion