2 Pages

finalsample1sols

Course: CS 322, Fall 2009
School: Washington
Rating:
 
 
 
 
 

Word Count: 1000

Document Preview

Formal CSE322: Models in Computer Science Partial Solutions to Sample Final Spring 2006 This handout has (partial) solutions to some of the problems in the sample final exam that was handed out in class on Friday, May 26. I have not given solutions to any of the "mechanical" questions (like converting CFG to PDA). Also the solutions are terse they are meant to give you the gist of the solution...

Register Now

Unformatted Document Excerpt

Coursehero >> Washington >> Washington >> CS 322

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Formal CSE322: Models in Computer Science Partial Solutions to Sample Final Spring 2006 This handout has (partial) solutions to some of the problems in the sample final exam that was handed out in class on Friday, May 26. I have not given solutions to any of the "mechanical" questions (like converting CFG to PDA). Also the solutions are terse they are meant to give you the gist of the solution and should not be considered as "model" solutions. In particular, you can (and most probably will) lose credit in the final exam if your answers are not fleshed out more. 1. (True/False with justification questions) (a) False. The PDA could just push a "dummy" symbol onto the stack and never really use it in its' computation. (b) True. Use the pumping lemma for regular languages (as the language is infinite, it will have an s in the language such that |s| p, where p is the pumping length). (c) False. The set of syntactically correct programs can be generated by a context-free grammar. Checking whether an input w can be generated by a CFG G is exactly the same as deciding ACF G , which is decidable. (d) False. Let R = . Then L = which is regular (and hence, a CFL). Now K can be any arbitrary language. (e) True. This is just the contra-positive of the closure of intersection of a CFL with a regular language. (f) True. The statement is "equivalent" to the halting problem. In particular, if the statement is false, then there would exist a decider (call it D) that can tell given an arbitrary TM P and w, whether P loops on w or not. Given such a decider, one can construct a decider for AT M as follows. On input P, w , first run the input on D. If D says yes, then simulate P on w and return the simulation's answer , otherwise reject. Of course, AT M is undecidable and hence, we have a contradiction. (g) True. The number of possible stack arrangements is finite (in fact, bounded by (|| + 1)100 ). Thus, one can "encode" all the possibilities in the states of a (huge) DFA. (h) True. Just "reverse" the transitions. (i) False. ACF G is decidable. (j) True. There are languages that are context-free but not regular. 2. (Classifying languages) (a) B. Here is a CFG for the language To show it is not regular, use pumping lemma with s = ap b2p+1 . (b) A. The language is the same as {am | m mod 3 1}. (c) A. One can express this language as La Lb La Lb La Lb , where La = {an | n i mod 3}, 1 1 2 2 0 0 i Lb = {bn | n i mod 3} (i = 0, 1, 2). i S aSbb | b (d) B. The language is the intersection of a CFL language ({xcxR | x {a, b} }) and a regular language ((b ab ab ) c(b ab ab ) . To prove this language is not regular use the lemma pumping with s = a2p ca2p . 1 (e) B. The PDA for this language works as follows. Push in all the a's and b's that come in and match each of them with the c's. To prove that this language is not regular use the pumping lemma with s = ap bp c2p . (f) B. The PDA for this language non-deterministically decides which of k = i or k = j is true and then goes on to check that part. To prove that this language is not regular, use the pumping lemma with s = ap bp!+p ap!+p and pump i = p!/|y| + 1 times. (g) C. An intuitive argument is that to check both conditions, one needs two stacks. (h) B. This language is L L, where L = {0n 1n | n 0}. For non-regularity use pumping lemma with s = 0p 1p . (i) C. Again one needs two stacks to do this. Consider the following natural one stack PDA candidate (that does not work). First push in all the a's and then the b's. However, to match the a's one has to pop off all the b's, which will not allow the matching of b's later. (j) A. This language is the set of all non-empty strings. To see this note that any z {a, b} , with z = can be written as xy, where x = and y = z. 3. Let pi denote the ith prime number and note that the sequence p1 , p2 , . . . is infinite. Now for using the Myhill-Nerode theorem, choose xi = 0pi and pick zij = 1pi . To finish the argument use the fact that for any i = j, gcd(pi , pj ) = 1. 4. I will skip parts (a) and (b) as they are "mechanical". For part (c), G generates all strings over {a, b} that have twice as many a's as b's. 5. Here is the "informal" description of the grammar: S aSaSbSb | aSbSaSb | aSbSbSa | bSbS...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Washington - CS - 322
1 CSE 322: Formal Models in Computer Science April 2, 2008 HandoutN,S,W,ENNN,EQQQ Fremont Troll o QQQ y QQQ QQQ QQQ N,S,W N QQQ Q@ E G Queen Anne Ave o Villa Sophia o W iRRR y RRR RRR N S RRR W R Space Needle o yNWGas Works Park o
Washington - CS - 322
CSE 322 Introduction to Formal Models in Computer ScienceDefining from In the definition of DFAs, the transition function explicitly describes, for each character a , the name of the state reached on a when started at state q. This is precisely
Washington - CS - 322
Washington - CS - 322
CSE 322: Formal Models in Computer Science Website: http:/www.cs.washington.edu/322 Lecture Times: MWF 1:30-2:30 in EE 045 (in the dungeon of EE.) Instructor: Dave Bacon Office: CSE 460 Email: dabacon@cs.washington.edu Phone: 206-221-6503 Office hour
Washington - CS - 521
CSE 521: Design and Analysis of Algorithms Winter 2005 Course InformationInstructor: TAs:Anna R. Karlin Neva Cherniavsky Ning ChenPGA 594 PGA 378 PGA 310karlin@cs.washington.edu nchernia@cs.washington.edu ning@cs.washington.edu543-9344 685-
Washington - CS - 521
CSE 521: Design and Analysis of Algorithms Assignment #0 January 3, 2005 Due: Wednesday, January 5Reading Assignment: Kleinberg and Tardos, Chapters 1 and 4 Questions: 1. For each of the following topics, indicate your level of comfort on a scale o
Washington - CS - 521
CSE 521: Design and Analysis of Algorithms Assignment #1 January 5, 2005 Due: Wednesday, January 12Reading Assignment: Kleinberg and Tardos, Chapters 1 and 4 Problems:1. Gale and Shapley published their paper on the stable marriage problem in 196
Washington - CS - 521
CSE 521: Design and Analysis of Algorithms Assignment #2 January 12, 2005 Due: Wednesday, January 19 Reading Assignment: K&T, Section 5.1, 5.2, 5.4, 5.6, 5.7, 5.9 Questions: 1. (Kleinberg and Tardos, Chapter 4, Problem 5) Let's consider a long, quiet
Washington - CS - 521
CSE 521: Design and Analysis of Algorithms Assignment #4 January 27, 2005 Due: Wednesday, February 2Reading Assignment: Kleinberg and Tardos, Network Flow, handout on linear programming, section 11.6 in new book. Problems:1. Let G = (V, E) be a g
Washington - CS - 521
CSE 521: Design and Analysis of Algorithms Assignment #5 February 2, 2005 Due: Wednesday, February 9Reading Assignment: Kleinberg and Tardos, Network Flow, handout on linear programming Problems: 1. Your friends have written a very fast piece of ma
Washington - CS - 521
CSE 521: Design and Analysis of Algorithms Assignment #6 Due: Wednesday, February 16Reading Assignment: Linear programming handouts, chapter on randomized algorithms, other randomized algorithms handouts (we'll send out mail about them.) Problems:
Washington - CS - 521
CSE 521: Design and Analysis of Algorithms Assignment #7 Due: Wednesday, Feb 23Problems:1. QuickSelect is the following simple algorithm for finding the k-th smallest element in an unsorted set S. QuickSelect(S, k): (a) Pick a pivot element p uni
Washington - CS - 521
Name:1 2 3 4 total/ 9 /10 /16 /39 /74CSE 521 Final ExamMarch 15, 2004 Instructions: You have 1 hour and 50 minutes to complete the exam. The exam is closed book, closed notes. Please do not turn the page until you are instructed to do so.
Washington - CS - 421
Measuring efficiency: The RAM modelnRAM = Random Access Machine Time # of instructions executed in an ideal assembly languagennComplexity and Representative ProblemsWinter 2005 Paul Beameneach simple operation (+,*,-,=,if,call) takes on
Washington - CS - 421
Undirected Graph G = (V,E)1 2 3 11 10Graph TraversalWinter 2005 Paul Beame12 4 5 6 7 8 13 9Directed Graph G = (V,E)1 2 3 11 12 4 5 6 7 8 13 9n n nGraph TraversalLearn the basic structure of a graph Walk from a fixed starting vertex s to
Washington - CS - 421
Greedy AlgorithmsnHard to define exactly but can give general propertiesn nGreedy AlgorithmsWinter 2005 Paul BeamenSolution is built in small steps Decisions on how to build the solution are made to maximize some criterion without looking t
Washington - CS - 421
Dynamic ProgrammingnDynamic ProgrammingnGive a solution of a problem using smaller sub-problems where all the possible sub-problems are determined in advance Useful when the same sub-problems show up again and again in the solutionDynamic Pro
Washington - CS - 421
Bipartite MatchingnnGiven: A bipartite graph G=(V,E)ME is a matching in G iff no two edges in M share a vertexnNetwork FlowWinter 2005 Paul BeameGoal: Find a matching M in G of maximum possible sizeBipartite MatchingBipartite Matchin
Washington - CS - 421
Dealing with NP-completenessWinter 2005 Paul BeameWhat to do if the problem you want to solve is NP-hardnYou might have phrased your problem too generallyne.g., in practice, the graphs that actually arise are far from arbitrary n maybe they
Washington - CSE - 590
Washington - CSEP - 590
Homeland Security / Cyber Security Autumn 2005N.B. CONTINUALLY IN FLUX Version 24: November 22 Course Requirements: Red Team Exercise (~25%): You are a member of a 5-6 person team of engineers and policy professionals that has been hired by the Depa
Washington - CSEP - 590
Homeland Security / Cyber Security Autumn 2005N.B. CONTINUALLY IN FLUX Version 24: November 22 Course Requirements: Red Team Exercise (~25%): You are a member of a 5-6 person team of engineers and policy professionals that has been hired by the Depa
Washington - CSEP - 590
CSE P 590TU: Homeland Security / Cyber Security Course Grade Histogram for UW Students4.0 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0X X X X X X X X X XX X X X X X X X X XX X X X X X X X X X X X X X X X X X X X X X X X X
Washington - CSEP - 590
Red Team ReportHemavathy Alaganandam Parvez Anandam Jameel Alsalam Yi-Kai Liu Pravin Mittal Elena Rodriguez-Vieitez Santeri VoutilainenUniversity of Washington CSE P 590TU UC Berkeley PP 190/290-009 UCSD CSE 291 (C00) Christine Hartmann-Siantar P
Washington - CSEP - 590
Buffer Overflows: Implications for Civilian CybersecurityAndrew Hoskinsahoskins@microsoft.comMark O. Ihimoyanmark.ihimoyan@microsoft.comAdeel Rasul Iqbalaiqbal@uclink.berkeley.eduKeunwoo Leeklee@cs.washington.eduThanh Nhut Nguyenttnguye
Washington - CSEP - 590
Homeland Security / Cyber Security Autumn 2005 Course Project ("White Paper") Assignment, and Topic SuggestionsVersion 5: November 2 White Paper (~55%): Teams of 3-5 students will provide a comprehensive report describing a particular threat, assess
Washington - CSEP - 590
Homeland Security / Cyber Security Autumn 2005 Course Project ("White Paper") Assignment, and Topic SuggestionsVersion 5: November 2 White Paper (~55%): Teams of 3-5 students will provide a comprehensive report describing a particular threat, assess
Washington - CSEP - 590
Homeland Security / Cyber SecurityChris Hartmann-Siantar, Lawrence Livermore National Laboratory Ed Lazowska, UW Computer Science & Engineering Steve Maurer, UC Berkeley Goldman School of Public Policy Stefan Savage, UCSD Computer Science & Engineer
Washington - CSEP - 590
Information Technology and Public PolicyEd Lazowska, Computer Science & Engineering, University of Washington Steve Maurer, Goldman School of Public Policy, University of California Berkeley Notes for presenters Students will be located at four site
Washington - CS - 321
CSE 321: Discrete Structures Assignment #1 January 7, 2009 Due: Wednesday, January 14Reading Assignment: Read Sections 1.1 - 1.4 carefully (make sure that you understand the examples). Problems: 1. Let p, q, r be the propositions. p You get sued by
Washington - CS - 321
CSE 321: Discrete Structures Assignment #2 January 15, 2009 Due: Thursday, January 22, in SectionReading Assignment: Sections 1.5 1.7 and handout on logic. Problems: 1. Determine the truth value of xy(x y 2 ) when the universe of discourse is the