old-final-solutions

# old-final-solutions - Solutions to Old Final Exams (For...

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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Solutions to Old Final Exams (For Fall 2007) CS 381 (Fall 2002, Fall 2004, Fall 2005, Fall 2006) Yogi Sharma Disclaimer: I, Yogi Sharma, do not claim these solution to be complete, or even to be absolutely correct. Use at your own risk. I just wrote them hurriedly, and, although the chances are small, they might contain some error(s). 1 Fall 2002 1.1 Problem 1 The set remains regular. Given an automaton for R , you could make au- tomaton for the set which has two b s erased. The new automaton will behave similar to the automaton for R but will guess twice during its run that a b was present in the original string at the point of guessing, and in the end it checks that the string is accepted. 1.2 Problem 2 The resulting set might not even be context-free. Consider { ( abc ) } . After rearrangement, it becomes { a n b n c n | n } which is not context-free. 1.3 Problem 3 It is context free. The pda guesses whether i = k or j = l . Once this guess it made, it ignores the irrelevent symbols. For example, if it guesses that j = l , then it ignore a s, pushes b s, ignores c s and pop b s on seeing d s. 1.4 Problem 4 (a) It is not. The language { a n b n c m } is context free, so is { a m b n c n } . But their intersection is our favorite non-context-free language, that is { a n b n c n } . 1 (b) It is closed under homomorphism. This can be seen by proving that CFLs are closed under substitution and homomorphism is a special case of substitution. (See book page 284 for proof.) (c) It is closed under inverse homomorphism too. The construction is a little involved though, although the idea is simple. See page 289 in the book. 1.5 Problem 5 The halting problem (HP) is undecidable. We did this in the review session on Monday. The idea is to prove that if HP were decidable, then L D will be recursive, a disaster and a mathematical calamity. 1.6 Problem 6 (a) The set of finite automaton that accept no string. (b) Does not exist. (c) The same as in first part, the set if RE (in fact it is recursive), and the complement is recursive....
View Full Document

## This homework help was uploaded on 02/02/2008 for the course CS 3810 taught by Professor Hopcroft during the Spring '07 term at Cornell University (Engineering School).

### Page1 / 7

old-final-solutions - Solutions to Old Final Exams (For...

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

View Full Document
Ask a homework question - tutors are online