recategorized by
395 views

2 Answers

Best answer
2 votes
2 votes

For this let us think about the corresponding regular expression which makes the analysis easier :

The language description says : Each '1' in the string should be succeeded by '0' . So in other words , we can have any number of 0's but we have '1' in input , that should be succeeded by '0' . 

Hence the regular expression is   : (0 + 10)*

Now the task reduces to making cases based on number of '10' units in the string . There can be 0 ,1 or 2 such units in the string as if we have 3 1's , then we need to have 3 0's as well which will make the length of the string = 6 but we need required strings of length = 5 only.

Case 1 : Only 0's : 

Now it is nothing permutation of 5 identical things which is done as :  5! / 5!  = 1 way

Case 2 : 1 '10' unit , 3 0's :

So now we have 4 units ,with three identical units which are '0' in this case.Hence number of ways  = 4! / 3! =  4 ways

Case 3 : 2 '10' units , 1 '0' : 

So now we have 3 units with 2 identical units of '10's . Hence number of ways  =   3! / 2!  =   3 ways

Hence total number of required strings of length 5  =   1  + 4 + 3

                                                                          =   8 

selected by
0 votes
0 votes
what is the answer?

Related questions

0 votes
0 votes
0 answers
2
Kuldeep Pal asked Dec 3, 2017
261 views
Time complexity to find a string of length k is accepted by a given deterministic finite automata on n states, over 2 symbol input alphabet isA. O(k)B. O(nk)C. O(klogn)D....
1 votes
1 votes
1 answer
4
Kuldeep Pal asked Dec 3, 2017
300 views
Which of the above is(are) CFL(s)?A. L1 and L2B. Only L1C. Only L2D. None