At Aba 1
At Aba 1
BY :
CHAITHANYA S 4VV20CS021
CHINMAYI H 4VV20CS024
HAMSINI D 4VV20CS046
Pattern searching
Examples:
• For example :
Let us see how to get the next state from current state 5
and character ‘C’ in the above diagram.
1. We need to consider the string, “pat[0..4]C” which is
“ACACAC”.
return 0;
}
/* This function builds the TF table which represents4
Finite Automata for a given pattern */
void computeTF(char *pat, int M, int TF[][NO_OF_CHARS])
{
int state, x;
for (state = 0; state <= M; ++state)
for (x = 0; x < NO_OF_CHARS; ++x)
TF[state][x] = getNextState(pat, M, state, x);
}
int TF[M+1][NO_OF_CHARS];
computeTF(pat, M, TF);
Output: