Download - Homework 1
![Page 1: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/1.jpg)
CS340Homework Assignment 1 using JFLAP
1. which strings (0001, 01001, 0000110) are accepted by the dfa in figure 2.10001 = Accept01001 = Accept0000110 = Reject
2(a) L = { all strings with exactly one a}
![Page 2: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/2.jpg)
2(b) L = { all strings with at least one a}
![Page 3: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/3.jpg)
2(d) L = { all strings with at least one a and exactly two b’s}
![Page 4: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/4.jpg)
2(e) L = { all strings with exactly 2 a’s and more than two b’s}
![Page 5: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/5.jpg)
5.(b) L = { abnam : n >= 2, m >=3 }
![Page 6: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/6.jpg)
5.c) L = { w1 ab w2 : w1 {a,b}*, w2 {a,b}* }
![Page 7: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/7.jpg)
6. With ∑ = {a,b}, give a dfa for L = {w1 a w2 : |w1| =3, |w2| <=5 }
![Page 8: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/8.jpg)
7. (b) L = { w : |w| mod 5 != 0}
![Page 9: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/9.jpg)
7.c) L = { w : Na(w) mod 3 > 1}
![Page 10: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/10.jpg)
7(e) L = { w: ( Na(w) – Nb(w) ) mod 3 > 0}
![Page 11: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/11.jpg)
7(f) L = { w: ( Na(w) + 2* Nb(w) ) mod 3 < 2}
![Page 12: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/12.jpg)
8.(a) L = {w : w contains no runs of length less than four}
![Page 13: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/13.jpg)
8(b) L = {w : w every run of a’s has length either 2 or 3}
![Page 14: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/14.jpg)
8.c) L = {w : there are at most two runs of a’s of length 3}
![Page 15: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/15.jpg)
![Page 16: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/16.jpg)
8(d) L = {w : there are exactly two runs of a’s of length 3}
![Page 17: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/17.jpg)
9.(b) L = { all strings containing 00 but not 000}
![Page 18: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/18.jpg)
9.c) L = { all strings in which the first (leftmost) symbol differs from the last (rightmost)}
![Page 19: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/19.jpg)
9(e) L = { all strings of length 3 or more in which the second symbol from the right is different from the leftmost symbol}
![Page 20: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/20.jpg)
9(f) L = { all strings which the leftmost two symbols and the rightmost two symbols are identical}
![Page 21: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/21.jpg)
9(G) L = { all strings of length four or greater in which the leftmost three symbols are the same but different from the rightmost symbol}
![Page 22: Homework 1](https://reader033.vdocuments.net/reader033/viewer/2022061203/547d9215b4af9fb40e8b4693/html5/thumbnails/22.jpg)
10. Construct a DFA that accepts strings on {0,1} if and only if the value of the string interpreted as a binary representation of an integer is zero modulo five. For example, 0101 and 1111 (5 and 15) are accepted.