cps102-hw1

cps102-hw1 - CPS 102: Discrete Mathematics Instructor:...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CPS 102: Discrete Mathematics Instructor: Bruce Maggs Assignment 1 Due: Monday, September 19th, 2011 1 Designing DFAs (35 points) Let = { , 1 } . For each of the following languages, give the state diagram for a DFA that recog- nizes it. (a) (4 pts) L 1 = { w : w contains the substring 010 } (b) (4 pts) L 2 = { w : w begins and ends with an even number of 1s } (c) (5 pts) L 3 is the language that consists of all strings such that between every two 1s, there is an even number of 0s. (d) (5 pts) L 4 is the language that consists of all strings w such that w ends in an odd number of 1s and w contains an even number of 0s. (e) (5 pts) L = { w | w contains an even number of 1s or exactly one 0 } . Examples in L : 11, 10, 101, 00, . Examples not in L : 111, 100, 1. (f) (5 pts) * * 1 * * Examples in L : 010, 000110, 11011001. Examples not in L : 111, 011, 00011. (g) (7 pts) L = { w | w is a binary number divisible by 2, given least significant digit first } . Ex- amples in L : 0, 01, 001, 010, 01011. Examples not in L : 1, 111, 101. 1 2 DFAs can verify addition (15 points) DFAs cant count, but they can verify addition. Consider an alphabet with rather interesting symbols: = , 1 , 1 , 1 1 , 1 , 1 1 , 1 1 , 1 1 1 which represent columns which could appear when writing the addition and result of two binary numbers. An input of length n represents the addition of two n-bit numbers where the input is given from least to most significant bit. The first numbers binary representation is in the top row, the second numbers representation is in the middle row, and the result is in the bottom row. Let L be the language of strings over this alphabet which represent correct addition statements as described above. As an example, correctly representing 4 + 2 = 6 in this scheme would give the following string (first input symbol on the left) 1 1 1 1 The following input would represent 4 + 5 = 8, and thus this string should not be in L : 1 1 1 1 Write a DFA which accepts L . Keep your DFA small; machines with more than 5 states will....
View Full Document

Page1 / 5

cps102-hw1 - CPS 102: Discrete Mathematics Instructor:...

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