dfa automata

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>
#define NSTATES 3
#define NCHARS 2
#define NACCEPTS 1
int L[NSTATES][NCHARS]={{0,1},{0,2},{0,2}};
int ACCEPTS[NACCEPTS]={2};

main()
{
int state,ch,i;

for (state=0; (ch=getchar())!= -1&&ch!='\n';state=L[state][i])
  {i=ch-'0';}

     for(i=0;i<NACCEPTS;i++) 
     if(ACCEPTS[i]==state)
       {printf("yes\n");return(0);}

       printf("no\n");

       return(0);
}


this dfa accepts strings ending in 11(example 01010011) need to modify the dfa to accept strings that start with 01(011101) any help would be appreciated
Topic archived. No new replies allowed.