Question

In: Computer Science

What do these regular expressions mean in plain english? a) ba*b + (ab)* b) a*b* +...

What do these regular expressions mean in plain english?

a) ba*b + (ab)*

b) a*b* + b*ab

Solutions

Expert Solution

Answer(a) ba*b + (ab)*

  • if string start with b then after it can allow any number of a's (including zero a's) followed by single b

OR

  • if string start with a then it allow only single b and goes to the same cycle again and again.

Note: epsilon(ε) is also accepted by the above Regular Expression

Answer(b) a*b* + b*ab

  • any number of a's (including zero a's) followed by any number of b's

OR

  • any number of b's (including zero b's) followed by ab


Explanation:

Answer(a) ba*b + (ab)*

step-1 we have created NFA for ba*b + (ab)*

step-2 we have created DFA from NFA for ba*b + (ab)*

if string start with b then after it can allow any number of a's (including zero a's) followed by single b

OR

if string start with a then it allow only single b and goes to the same cycle again and again.

Note: epsilon is also accepted by the above Regular Expression

Answer(b) a*b* + b*ab

any number of a's (including zero a's) followed by any number of b's

OR

any number of b's (including zero b's) followed by ab

For better understanding we have created Finite Automata ( NFA/ε-NFA/DFA) for the given Regular Expression step by step.

step-1 we have created ε-NFA for a*b*

step-2 we have created NFA for a*b*

step-3 we have created NFA for b*ab

step-4 we have created ε-NFA for a*b* + b*ab

step-5 we have created NFA for a*b* + b*ab

Best Of Luck...


Related Solutions

Regular Expressions. What are they? What do they do for us?
in c#Regular Expressions. What are they? What do they do for us? What is their power and what challenges to they present to writing solid code?
Suppose A and B are regular language. Prove that AB is regular
Suppose A and B are regular language. Prove that AB is regular
Prove the following using the properties of regular expressions: (ab)* + c + c* = Λ...
Prove the following using the properties of regular expressions: (ab)* + c + c* = Λ + ab + (ab)* + c(Λ + c*)   Λ+ab+abab+ababab(ab)* = Λ + ∅* + (ab)* a(b+c*) + (d+e)* = ab + ac*c* + d + e + (d+e)* a*b + a*a*bc* + d* + ab = d* + ab + a*bc* + Λ a(b+cd*) = a(b+c) + acdd* (a+b)* = ∧* + ∅* + (a*b*)* (ab)*(c*+d*) = (ab)*(c+c*) + (ab)*( ∧ + d*)
Give the finite-state automaton and the regular grammar for the following: (a) (ab v ba)* v...
Give the finite-state automaton and the regular grammar for the following: (a) (ab v ba)* v (ab)* (b) (11*)*(110 v 01) (c) All strings over {0,1} containing the string 010 (d) All strings over {0,1} which do not contain the string 010
(A) Explain what a Fourier Transform (FT) does in plain English. (B) Explain the advantages of...
(A) Explain what a Fourier Transform (FT) does in plain English. (B) Explain the advantages of a FT instrument over a constant wavelength diffuse instrument.
Let U = {A ∈ Mat(2; ℚ) : AB = BA for all B ∈ Mat(2;...
Let U = {A ∈ Mat(2; ℚ) : AB = BA for all B ∈ Mat(2; ℚ)}. (i) Show that  U is a subspace of Mat(2; ℚ). (ii) Show that E ∈ Mat(2; ℚ) is a basis of U. (E: identity matrix) (iii) Find the complement for U
In plain English explain each of the template sections and what goes in it { “AWSTemplateFormatVersion”...
In plain English explain each of the template sections and what goes in it { “AWSTemplateFormatVersion” : “2010-09-09”, “Description” : “Cloudformation Template Review”, “Parameters” : {    …   }, “Mappings” : {    … }, “Conditions” : {    … }, “Resources” : {    … }, “Outputs” : {    … } }
4. Construct regular expressions for the following languages over the alphabet {a, b}: a. Strings that...
4. Construct regular expressions for the following languages over the alphabet {a, b}: a. Strings that do not begin with an “a”. b. Strings that contain both aa and bb as substrings. 5. Let ? = {? ?? ?? ? | ? > ? + ?}. a. List all strings of length 7. (use power notation: i.e. aabbbbaaaaaaaa is a2b 4a 8 ) b. Use the Pumping Lemma for Regular Languages to prove that L is not regular.
What does the central limit theorem mean in plain words and what do we use it...
What does the central limit theorem mean in plain words and what do we use it for?
What do we mean by a "normal balance"? Can you explain this to us in plain...
What do we mean by a "normal balance"? Can you explain this to us in plain old English? If you know what it means when we say that Cash has a normal debit balance, or Accounts Payable will have a normal credit balance, this will help you in better understanding the big picture for this week's key topics!
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT