Question

Give a regular expression for the set of strings over {a, b, c} such that the...

Give a regular expression for the set of strings over {a, b, c} such that the sum of the number of a’s and the number of b’s is equal to 3.

Homework Answers

Answer #1

Solution for the regular expression is provided below. If any doubt please comment below.

Need to find the regular expression for which the sum of number of a and number of b is three. The input alphabet is{a, b, c}.

There are 8 possibilities for the sum of number of a and b as 3 (excluding c).

  • aaa
  • aab
  • aba
  • abb
  • baa
  • bab
  • bba
  • bbb

Now include c in all these possibilities. There is no restriction on number of c.

Required regular expression:

c*ac*ac*ac* + c*ac*ac*bc* + c*ac*bc*ac* + c*ac*bc*bc* + c*bc*ac*ac* + c*bc*ac*bc* + c*bc*bc*ac* + c*bc*bc*bc*

Here c* denotes zero or more occurrence of c.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Find a regular expression to describe: The set of all strings over the alphabet {a, b,...
Find a regular expression to describe: The set of all strings over the alphabet {a, b, c, d} that contain exactly one a and exactly one b So, for example, the following strings are in this language: ab, ba, cccbad, acbd, cabddddd, ddbdddacccc and the following strings are NOT in this language: a, ccbc, acbcaaacba, acacac, bcbbbbbca, aca, c, d, b
Give a regular expression for the set of all strings on the alphabet {0,1} with no...
Give a regular expression for the set of all strings on the alphabet {0,1} with no runs of length greater than 3(for example, no substrings 0^i or 1^i with i > 3)
Show a regular expression representing the described set: a). The set of strings of odd length...
Show a regular expression representing the described set: a). The set of strings of odd length over {s,t,r,i,n,g} containing exactly 3 n's.
Write the regular expression for the following sets (4.5) 4.1 All strings over {a,b} that are...
Write the regular expression for the following sets (4.5) 4.1 All strings over {a,b} that are odd in length 4.2 All strings over {a,b} whose length is not a multiple of 3 4.3 All strings over a,b that start with aa and end with bb
Give a recursive definition for the set of all strings of a’s and b’s where all...
Give a recursive definition for the set of all strings of a’s and b’s where all the strings are of even lengths. Please format using: 1)Base: 2) Recursion: 3)Restrictions:
Give a CFG that consists of strings where all a’s appear before b’s, all b’s appear...
Give a CFG that consists of strings where all a’s appear before b’s, all b’s appear before c’s, there are an equal number of a’s and c’s, and an even number of b’s. After construct a PDA for this CFG
Problem 5 Regular Expressions. a) Define a regular expression for all strings of odd length, over...
Problem 5 Regular Expressions. a) Define a regular expression for all strings of odd length, over the alphabet of {0}. b) Define a regular expression for identifiers over the alphabet of {A,B,C,a,b,c,0,1,2,3,4,5,6,7,8,9}, such that an identifier must begin with an alphabetic character and must contain at least one numeric character. c) Try to modify the definition above so that identifiers still begin with an alphabetic character, but after that, it must contain at least one numeric, at least one lower-case...
Consider the regular expression ? = b(ba U aab)*(b U a*). In lexicographical order (shorter strings...
Consider the regular expression ? = b(ba U aab)*(b U a*). In lexicographical order (shorter strings before longer strings, alphabetical order for strings of the same length), give the 8 shortest strings in the language generated by ?.
For each of the following regular expressions, give 2 examples of strings that are in the...
For each of the following regular expressions, give 2 examples of strings that are in the language described by the regular expression, and 2 examples of strings that are not in that language. In all cases the alphabet is {a,b}. ab*ba* (a ∪ ε)b* (a ∪ b)ε*(aa ∪ bb)
For each of the following regular expressions, give 2 examples of strings that are in the...
For each of the following regular expressions, give 2 examples of strings that are in the language described by the regular expression, and 2 examples of strings that are not in that language. In all cases the alphabet is {a, b}. ab*ba* (a ∪ ε)b* (a ∪ b)ε*(aa ∪ bb)
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT