Question

This question deals with NFAs, DFAs, and regular expressions. (a) Using only the symbols described in...

This question deals with NFAs, DFAs, and regular expressions.

  1. (a) Using only the symbols described in the lecture slides, write a regular expression that describes all strings over the alphabet Σ = {0,1} that are at are at least four bits long and begin and end with the same bit.

  2. (b) Draw a DFA, that accepts strings strings over the alphabet Σ = {0, 1} such that if you read the string from left to right, the difference between the number of 0s and 1s read up to any point in the string is never more than 2. For example, 10100111 and the ε (the empty string) would be accepted. However, 111000 would be rejected because it starts with 3 occurrences of a 1 before seeing a 0, and 01001101001001 would be rejected because when reading the last 0 in the string, that is the 8th occurrence of a 0 and only the 5th occurrence of a 1 at that point. The difference in this case is 3.

    Your solution must read all bits from the string. In other words, each state in the DFA must have a transition labelled with a 0 and a transition labelled with a 1.

  3. (c) Draw a finite state machine, either a DFA or an NFA, over the alphabet strings over the alphabet Σ = {a, b, c} that matches this regular expression:

                                 (a|b)* c a? b? c+ (a*|b*)
    

    Note that there are no spaces in this alphabet. The spaces are included in the regular expression for readability. Also, you are not required to read a whole string that would be rejected. In other words, a correct solution may contain states that do not have transitions for all possible inputs.

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

Dale

thankyou

Add a comment
Know the answer?
Add Answer to:
This question deals with NFAs, DFAs, and regular expressions. (a) Using only the symbols described in...
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
  • Answer all questions. Unless otherwise stated, all the DFAs and NFAs in this homework use 2-...

    Answer all questions. Unless otherwise stated, all the DFAs and NFAs in this homework use 2- 10,1j as the alphabet. 1. (50 point) For i-1,2 and 3, design NFAs Ni, such that L(N) - B5, where: (a) Bi-{w|w has an even number of O's, or, contains exactly two 1's) (b) ) B2- w every odd position of w is 1 (c) B3 - [w| all strings except the empty string and the string 11) (d) B4- [0j with two states....

  • 3. [20 points] Give short answers to each of the following parts. Each answer should be...

    3. [20 points] Give short answers to each of the following parts. Each answer should be at most three sentences. Be sure to define any notation that you use. (a) Explain the difference between a DFA and an NFA. (b) Give a regular expression for the language consisting of strings over the alphabet 2-(0, 1) that contains an even number of 0's and an odd number of 1's and does not contain the substring 01. (c) Give the formal definition...

  • Regular expressions, DFA, NFA, grammars, languages Regular Languages 4 4 1. Write English descriptions for the...

    Regular expressions, DFA, NFA, grammars, languages Regular Languages 4 4 1. Write English descriptions for the languages generated by the following regular expressions: (a) (01... 9|A|B|C|D|E|F)+(2X) (b) (ab)*(a|ble) 2. Write regular expressions for each of the following. (a) All strings of lowercase letters that begin and end in a. (b) All strings of digits that contain no leading zeros. (c) All strings of digits that represent even numbers. (d) Strings over the alphabet {a,b,c} with an even number of a's....

  • Just answer the second problem the photo is my answer for first one and need to...

    Just answer the second problem the photo is my answer for first one and need to use in the second problem all questions. Unless otherwise stated, all the DFAs and 1 /2 1 this homework use Σ-(0, 1 } as the alphabet. (50 point) For i=1, 2, 3, 4 and 5, design NFAs Ni, such that L(M) = Bi, where 1, (a) Bi -[w w has an even number of O's, or, contains exactly two 1's). (b) B2-[w every odd...

  • UueSLIORS! 1. Find the error in logic in the following statement: We know that a b'...

    UueSLIORS! 1. Find the error in logic in the following statement: We know that a b' is a context-free, not regular language. The class of context-free languages are not closed under complement, so its complement is not context free. But we know that its complement is context-free. 2. We have proved that the regular languages are closed under string reversal. Prove here that the context-free languages are closed under string reversal. 3. Part 1: Find an NFA with 3 states...

  • Question 1: Every language is regular T/F Question 2: There exists a DFA that has only...

    Question 1: Every language is regular T/F Question 2: There exists a DFA that has only one final state T/F Question 3: Let M be a DFA, and define flip(M) as the DFA which is identical to M except you flip that final state. Then for every M, the language L(M)^c (complement) = L( flip (M)). T/F Question 4: Let G be a right linear grammar, and reverse(G)=reverse of G, i.e. if G has a rule A -> w B...

  • Finite state machines & Regular Expressions Please select the best option 1. For the following questions...

    Finite state machines & Regular Expressions Please select the best option 1. For the following questions Let r, s, t be regular expressions for the same alphabet "á" (left column). Get the property on the right side that produces equality for each regular expression.                      2. From the diagram of the solution M = (Σ, Q, s,, F) is respectively: e would be NONE. 3. The following graph corresponds to a diagram of: A. Transition machine and states b. Transition...

  • I would like some assistance correcting an issue I am having with this assignment. Once a...

    I would like some assistance correcting an issue I am having with this assignment. Once a finite state automaton (FSA) is designed, its transition diagram can be translated in a straightforward manner into program code. However, this translation process is considerably tedious if the FSA is large and troublesome if the design is modified. The reason is that the transition information and mechanism are combined in the translation. To do it differently, we can design a general data structure such...

  • Two words or phrases in English are anagrams if their letters (and only their letters), rearranged,...

    Two words or phrases in English are anagrams if their letters (and only their letters), rearranged, are the same. We assume that upper and lower case are indistinguishable, and punctuation and spaces don't count. Two phrases are anagrams if they contain exactly the same number of exactly the same letters, e.g., 3 A's, 0 B's, 2 C's, and so forth. Some examples and non-examples of regular anagrams: * The eyes / they see (yes) * moo / mo (no) *...

  • I need to update this code: #include <iostream> #include <string> #include <cctype> using namespace std; int...

    I need to update this code: #include <iostream> #include <string> #include <cctype> using namespace std; int main() { string s; cout<< "Enter a string" <<endl; getline (cin,s); cout<< s <<endl; int vowels=0,consonants=0,digits=0,specialChar=0; for (int i=0; i<s.length(); i++) { char ch=s[i]; if (isalpha(s[i])!= 0){ s[i]= toupper(s[i]);    if (ch == 'a'|| ch == 'e'|| ch == 'i'|| ch == 'o' || ch == 'u') vowels++; else consonants++; } else if (isdigit(s[i])!= 0) digits++; else specialChar++; } cout<<"Vowels="<<vowels<<endl; cout<<"Consonants="<<consonants<<endl; cout<<"Digits="<<digits<<endl; cout<<"Special Characters="<<specialChar<<endl;...

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