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

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
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.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/07/2010 for the course COMPUTER S 138 taught by Professor Icamarra during the Spring '10 term at UCLA.

Page1 / 6

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

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online