Question

A string can be viewed as alternating sequences of a’s and b’s. For example, a string...

A string can be viewed as alternating sequences of a’s and b’s. For example, a string that starts with an ‘a’ will have some number of a’s, followed by some number of b’s, followed by some number of a’s, etc. For the language that consists of all strings where there is an odd number of occurrences of sequences of a’s….

• Valid strings: aa, aababaa, bbaaa, abbaababbbaaaba, aaab

• Invalid strings: b, aba, baaba, abaaaabbaabbbba

To iterate: I want alternate a's and b's and it is important that a is odd number. I'm not sure how to process the odd part.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. b1*(ab*ab*)*ab*

This enumerate all possibilities of even number of A's .then at last ,sn extra a has to exist to make it odd.

This regular expression is equivalent to

b*a(b*ab*a)*b*

2. even number of b's and odd number of a's.

(a*ba*ba*)*

Add a comment
Know the answer?
Add Answer to:
A string can be viewed as alternating sequences of a’s and b’s. For example, a string...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 3 points) Question Three Consider the context-free grammar S >SS+1 SS 1a and the string aa...

    3 points) Question Three Consider the context-free grammar S >SS+1 SS 1a and the string aa Give a leftmost derivation for the string. 3 points) (4 poiots) (5 points) (3 points) sECTION IWOLAttcmpt.any 3.(or 2) questions from this.scction Suppose we have two tokens: (1) the keyword if, and (2) id-entifiers, which are strings of letters other than if. Show the DFA for these tokens. Give a nightmost derivation for the string. Give a parse tree for the string i) Is...

  • I'm having trouble writing this code, can some help me? Step 1: Capturing the input The...

    I'm having trouble writing this code, can some help me? Step 1: Capturing the input The first step is to write a functionGetInput()that inputs the expression from the keyboard and returns the tokens---the operands and operators---in a queue. You must write this function. To make the input easier to process, the operands and operators will be separated by one or more spaces, and the expression will be followed by #. For example, here’s a valid input to your program: 6...

  • In this assignment, you will explore more on text analysis and an elementary version of sentiment...

    In this assignment, you will explore more on text analysis and an elementary version of sentiment analysis. Sentiment analysis is the process of using a computer program to identify and categorise opinions in a piece of text in order to determine the writer’s attitude towards a particular topic (e.g., news, product, service etc.). The sentiment can be expressed as positive, negative or neutral. Create a Python file called a5.py that will perform text analysis on some text files. You can...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT