Algoritmo aho corasick

No puedo entender el siguiente algoritmo que se usa para la coincidencia de patrones de cadenas utilizando el algoritmo de Aho-Corasick

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

Respuestas a la pregunta(2)

Su respuesta a la pregunta