Last updated on:May 27th, 2018,

Regular expression for the language of an odd number of 1s

What is the regular expression for the language of an odd number of 1s?

Regular expression for the language of an odd number of 1’s is given below.

R.E = 010(01010)

Now, let’s discuss that what strings should be accepted or rejected by our Regular Expression.

Accepted Strings
You should check some small, some medium and some large size strings that are part of the language and all of them(100% strings) should be accepted by our R.E.
Small strings:

1, 01, 10, 010, 001, 100, 111, 1011 …… and all such strings that contain odd numbers of 1’s in the strings.

Medium size strings:

100100001, 11000001, 10110011,……and all such strings that contain odd numbers of 1’s in the strings.

Large size strings:

100000000100000001, 110001011100100000,…….and all such strings that contain odd numbers of 1’s in the string.

 

Rejected Strings
You should check some small, some medium and some large size strings that are not part of the language and all of them(100% strings) should be rejected by our R.E.
Small strings:

0, 00, 11, 011, 101, 100, 110, 1111 …… and all such strings that are not part of our language( does not contains odd numbers of 1’s in the strings).

Medium size strings:

1000001, 0100100101, 111100011 …… and all such strings that are not part of our language (does not contains odd numbers of 1’s in the strings).

Large size strings:

100000000100000011, 110001011100110000,…….and all such strings that do not contain odd numbers of 1’s in the string(not part of the language).

Topic Covered: 

Regular expression for the language of an odd number of 1s.
  List of All Regular Expression examples : Click Here 
.

0Shares

Leave a Reply

Your email address will not be published.