csci3255 HW 2-1

# csci3255 HW 2-1 - CSCI3255 Math Foundations of CS Chapter 2...

This preview shows pages 1–3. Sign up to view the full content.

CSCI3255: Math Foundations of CS Homework 2, (2.1), page 1 September 2006 Chapter 2, Section 1. Problems 1-15 1. Which of the following strings 0001, 01001, 0000110 are accepted by the dfa in Figure 2.1? Just “follow the bouncing ball.” Starting at the initial state, just follow the arrows and see where you wind up. 0001 leaves us in state q 1 , 01001 leaves us in state q 1 , and 0000110 leaves us in state q 2 . So the first two are accepted and the last one is rejected. 2. For Σ = { a , b } construct dfa’s that accepts the sets consisting of a. all strings with exactly one a . As done in class: b. all strings with at least one a . c. all strings with no more than three a ’s. (notice how the states indicate # of a ’s). d. all strings with at least one a and exactly two b ’s. When building a DFA, remember that the states have meaning. This language has two possibilities for a ’s: no a ’s or at least one a . It has four possibilities for b ’s: no b ’s, 1 b , 2 b ’s or more than two b ’s. So there are two times four, or eight states. I’ll label the states to point out their meaning. q 00 : no a ’s or b ’s, q 10 : at least one a but no b ’s, q 01 : no a ’s and 1 b , etc. 0 q 0 q 1 q 2 0 1 0 1 1 q 0 q 1 a b b a,b a q 2 a b a, b q 0 q 1 a a a a b b a,b b b q 0 q 1 q 2 q 3 q 4+ a a a a a a q 00 q 02+ q 01 q 02 q 12 q 12+ q 10 q 11 b a,b b b b b b b a

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CSCI3255: Math Foundations of CS Homework 2, (2.1), page 2 September 2006 e. all the strings with exactly two a ’s and more than two b ’s. 3. Show that if we change Figure 2.6, making q 3 a nonfinal state and making q 0 , q 1 , q 2 final states, the resulting dfa accepts . This will be true for any dfa. If we switch the final and non-final (non-accepting) states, then any string that leaves us in an accepting state in the original now leaves us in a non-final state (and vice-versa) because we have switched around which of the states is a final state.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern