t1sample - subsets of is not countable. answer: It is a...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
University of Central Florida School of Computer Science COT 4210 Spring 2004 Prof. Rene Peralta sample questions T1 1. Consider integers written in base 3 with no leading 0s. Let L 1 be the set of such strings representing numbers that are congruent to 3 mod 4. (a) Construct a DFA that accepts L 1 . (b) Construct a left-linear grammar for L 1 . answer: we have done this type of exercise ad nauseum, so I won’t write an answer here 2. Write a regular expression for the set of strings over Σ = { 0 , 1 } which have an odd number of 1’s. answer: note you do not need to go through the entire DFA grammar regular expression sequence. “Odd number of 1’s” means “one 1 plus an even number of 1’s”, so 0 * 10 * (0 * 10 * 10 * ) * . This is not the most compact representation, but we don’t care about that here. 3. Describe the four types of grammars in the Chomsky Hierarchy. answer: something like i) unrestricted, ii) | LHS | ≤ | RHS | , iii) | LHS | = 1 ; iv) right-linear. 4. Outline the argument that uses Cantor’s diagonalization technique to show the set of
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: subsets of is not countable. answer: It is a proof by contradiction: i) there is a bijection between innite binary strings and subsets of , so we count the former instead; ii) assume, for a contradiction, that the set of innite binary strings is countable; iii) the strings can thus be arranged in a list s (1) , s (2) , s (3) , . . . . iv) Let b(i) be the complement of the i th bit of s ( i ) ; v) Then ~ b is a string which is not in the list, contradiction. 5. Show, using the pumping lemma for regular languages, that the set T consisting of binary string with more 1 s than 0 s is not regular. answer: By contradiction. Assume the set is regular and let be the pumping constant given by the pumping lemma. Let = 11 . Then T . The pumping lemma implies we can erase a (non-empty) substring from the prex 11 with the resulting string still being in T . But this clearly cannot be done, contradiction....
View Full Document

This note was uploaded on 06/09/2011 for the course COT 4210 taught by Professor Staff during the Spring '08 term at University of Central Florida.

Ask a homework question - tutors are online