CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

If s is a string over (0+1), then let n0(s) denote the number of 0's in s and n1(s) the number of 1's in s. Which one of the following languages is not regular?


Open in App
Solution

Choise (a) is regular since it is finite.

Choise (b) is regular since although comparision is made between 0's and 1's, it is for all prefixes and this can be done by DFA.

Note: n0(s)n1(s)2issameasn0(s)n1(s)2orn1(s)n0(s)2.

Choice (c) involves comparision of number of 0's and 1's but for the string as a whole, and this cannot be done by a dfa, since it has finite memory and has no stack for counting upto infinity. Therefore, choice (c) is not regular.

Choice (d) is regular since n0(s)mod7=n1(s)mod5=0 means number of 0's is divisible by 7 and number of 1's is divisible by 5 and this can be accepted by a dfa with 7 × 5 = 35 states.

A minimal DFA that will accept the language of choice (b) is shown below:

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Understanding Divisibility
Watch in App
Join BYJU'S Learning Program
CrossIcon