DISCRETE STRUCTURES FINAL EXAM FALL 2005, SECTION 0201 (PICKETT)

Similar documents
FINAL EXAM CHEAT SHEET/STUDY GUIDE. You can use this as a study guide. You will also be able to use it on the Final Exam on

CS154 Final Examination

CS154 Final Examination

ECS 20: Discrete Mathematics for Computer Science UC Davis Phillip Rogaway June 12, Final Exam

Lecture 2: Connecting the Three Models

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama

MI 4 Mathematical Induction Name. Mathematical Induction

1 More finite deterministic automata

The purpose here is to classify computational problems according to their complexity. For that purpose we need first to agree on a computational

Theory Bridge Exam Example Questions

EXAM. CS331 Compiler Design Spring Please read all instructions, including these, carefully

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.

1. Draw a parse tree for the following derivation: S C A C C A b b b b A b b b b B b b b b a A a a b b b b a b a a b b 2. Show on your parse tree u,

ECS 120 Lesson 15 Turing Machines, Pt. 1

Introduction to Theory of Computing

CMPSCI 311: Introduction to Algorithms Second Midterm Exam

Johns Hopkins Math Tournament Proof Round: Automata

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Section 1 (closed-book) Total points 30

McGill University Faculty of Science. Solutions to Practice Final Examination Math 240 Discrete Structures 1. Time: 3 hours Marked out of 60

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005

Automata Theory - Quiz II (Solutions)

CpSc 421 Final Exam December 15, 2006

University of New Mexico Department of Computer Science. Final Examination. CS 561 Data Structures and Algorithms Fall, 2013

Automata Theory (2A) Young Won Lim 5/31/18

CISC4090: Theory of Computation

Part I: Definitions and Properties

Math 1 Summer Assignment 2017

DISCRETE STRUCTURES EXAM 2 FALL 2005, SECTION 0201 (PICKETT)

Homework Assignment 6 Answers

SOLUTION: SOLUTION: SOLUTION:

Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Turing Machines and Time Complexity

Finite Automata Theory and Formal Languages TMV026/TMV027/DIT321 Responsible: Ana Bove

Solution Scoring: SD Reg exp.: a(a

1 Functions, relations, and infinite cardinality

Math 187, Spring 2018: Test III

I have read and understand all of the instructions below, and I will obey the University Code on Academic Integrity.

1 The Basic Counting Principles

The exam is closed book, closed calculator, and closed notes except your one-page crib sheet.

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

6.841/18.405J: Advanced Complexity Wednesday, February 12, Lecture Lecture 3

Final exam study sheet for CS3719 Turing machines and decidability.

Chapter 5. Finite Automata

1. For the following sub-problems, consider the following context-free grammar: S AB$ (1) A xax (2) A B (3) B yby (5) B A (6)

Computability and Complexity

Boolean circuits. Lecture Definitions

CPSC 421: Tutorial #1

198:538 Complexity of Computation Lecture 16 Rutgers University, Spring March 2007

Finite Automata Part One

1 Functions, relations, and infinite cardinality

452 FINAL- VERSION E Do not open this exam until you are told. Read these instructions:

Finite Automata Part One

Finite Automata. Finite Automata

6.045 Final Exam Solutions

SE 3310b Theoretical Foundations of Software Engineering. Turing Machines. Aleksander Essex

Turing Machines Part Three

CMSC Discrete Mathematics SOLUTIONS TO FIRST MIDTERM EXAM October 18, 2005 posted Nov 2, 2005

CpSc 421 Homework 9 Solution

Mathematical Thinking Exam 2 20 November 2017

Please give details of your answer. A direct answer without explanation is not counted.

COMPLEXITY THEORY. PSPACE = SPACE(n k ) k N. NPSPACE = NSPACE(n k ) 10/30/2012. Space Complexity: Savitch's Theorem and PSPACE- Completeness

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

On P Systems with Active Membranes

CSCE 551 Final Exam, Spring 2004 Answer Key

COMPSCI 611 Advanced Algorithms Second Midterm Exam Fall 2017

Methods for the specification and verification of business processes MPB (6 cfu, 295AA)

STAT 516 Midterm Exam 2 Friday, March 7, 2008

CSE 105 Theory of Computation

CS481F01 Prelim 2 Solutions

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Review: Expressions and Equations

Discrete Event Systems Exam

COM S 330 Homework 08 Solutions. Type your answers to the following questions and submit a PDF file to Blackboard. One page per problem.

Student Activity: Finding Factors and Prime Factors

POLYNOMIAL SPACE QSAT. Games. Polynomial space cont d

MA/CSSE 474 Theory of Computation

Pushdown Automata. Reading: Chapter 6

Pushdown Automata: Introduction (2)

CS 311 Sample Final Examination

Final Exam Comments. UVa - cs302: Theory of Computation Spring < Total

Discrete Structures, Final Exam

CSCE 551 Final Exam, April 28, 2016 Answer Key

EXAM. Please read all instructions, including these, carefully NAME : Problem Max points Points 1 10 TOTAL 100

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata.

Week 2: Defining Computation

Midterm Exam 1 (Solutions)

Methods for the specification and verification of business processes MPB (6 cfu, 295AA)

Physics 101. Hour Exam I Fall Last Name: First Name Network-ID Discussion Section: Discussion TA Name:

CpSc 421 Final Exam December 6, 2008

Further discussion of Turing machines

Griffith University 3130CIT Theory of Computation (Based on slides by Harald Søndergaard of The University of Melbourne) Turing Machines 9-0

EECS 70 Discrete Mathematics and Probability Theory Fall 2015 Walrand/Rao Final

CS540 ANSWER SHEET

Final Examination. Adrian Georgi Josh Karen Lee Min Nikos Tina. There are 12 problems totaling 150 points. Total time is 170 minutes.

Foundations of Informatics: a Bridging Course

CSE 105 Theory of Computation

MAT 101 Exam 2 Logic (Part I) Fall Circle the correct answer on the following multiple-choice questions.

Transcription:

DISCRETE STRUCTURES FINAL EXAM FALL 2005, SECTION 0201 (PICKETT) NAME: This exam is worth 20% of your final grade (500/2500 points) There are 7 problems (and 1 BONUS problem) You have until 12:30 to finish You may use the final exam cheat sheet I ve provided, and calculators should be unnecessary Be sure to show your work, as I ll be giving partial credit 1

2 DISCRETE STRUCTURES FINAL EXAM FALL 2005, SECTION 0201 (PICKETT) (1) (50 points) Prove (using induction) that n i 2 = Answer: i=1 n (n + 1) (2n + 1) (1) (2) (3) (4) (5) () (7) (8) Base Case: 1(1+1)(2+1) = 1 = 1 2 Inductive step: Assume that k i=1 i2 = k(k+1)(2k+1) for k = 1 to n 1 Then n n 1 i 2 = n 2 + i 2 i=1 i=1 ( ) (n 1)((n 1) + 1)(2 (n 1) + 1) = n 2 + = n 2 (n 1)n(2n 1) + = n2 + (n 1) n (2n 1) n (n + (n 1)(2n 1)) = = n (n + (2n2 3n + 1)) = n (2n2 + 3n + 1) n (n + 1)(2n + 1) =

DISCRETE STRUCTURES FINAL EXAM FALL 2005, SECTION 0201 (PICKETT) 3 (2) (50 points) Of the 11! 2!2! ways to arrange the letters in the word SERENDIPITY, how many of them start and end with the same letter? Answer: The letter either has to be E or I In the case that it s E, there are 9! 2! ways to arrange the remaining letters, and likewise for the case the letter s I So there are 2 9! = 9! arrangements that start and end with the same letter 2!

4 DISCRETE STRUCTURES FINAL EXAM FALL 2005, SECTION 0201 (PICKETT) (3) (50 points) Set up a recurrence relation to find the number of ways to climb n stairs if the person climbing the stairs can take 1, 2, or 3 stairs at a time Don t forget to set up the base case(s) Answer: The base case is that a person has 1 way of climbing 1 stair So r 1 = 1 There are 2 ways to climb 2 stairs, and 4 ways to climb 3 stairs (1+1+1, 2+1, 1+2, and 3) For n more than 3, a person can climb 1 stair from n 1, 2 stairs from n 2, and 3 stairs from n 3 So the relation is r n = r n 1 + r n 2 + r n 3

DISCRETE STRUCTURES FINAL EXAM FALL 2005, SECTION 0201 (PICKETT) 5 (4) (100 points total plus 40 BONUS points) Consider the game called the Onion Rings of Hanoi In this game, there are 3 onion rings with different sizes: wee, not-so-wee, and FRIGGIN-HUGE There are 3 poles on which the onion rings can be stacked: Neutral, Home, and Visitor Initially, all 3 rings are stacked (wee atop notso-wee atop FRIGGIN-HUGE) on the Neutral pole The players, Home and Visitor, take turns moving the onion rings according to the following rules: Each turn, a player must move exactly 1 onion ring from one pole to another A player can only move the topmost onion ring from any stack A player can t put the not-so-wee onion ring atop the wee onion ring, and he or she can t put the FRIGGIN-HUGE onion ring atop either of the other 2 The winner of the game is the one who first gets the entire stack of onion rings onto his or her pole Home goes first Consider the graph where each node represents a game state, and there s a directed edge between 2 nodes if it s possible to immediately transition from one state to another (a) (50 points) How many nodes are in the game graph? (Remember that whose turn it is is part of the state) Answer: Each of the 3 onion rings can be on one of the 3 poles This gives 3 3 = 27 positions for the onion rings Additionally, it can be either player s turn, so this gives 54 nodes in the graph (We know that each of these positions can be reached because Home can move wee onto his own peg, then Visitor can move it onto his peg, then Home can move it back onto Neutral thus winding up as if Visitor had started the game) (b) (50 points) Is the game graph bipartite? If so, what are the 2 partitions of nodes?

DISCRETE STRUCTURES FINAL EXAM FALL 2005, SECTION 0201 (PICKETT) Answer: Yes, the graph is bipartite There are nodes where it s Home s turn and nodes where it s Visitor s turn, and since neither can go twice in a row, these sets are disjoint (c) (40 BONUS points) If we make it so there are only 2 rings, and we introduce a new rule that says that a player loses if he or she puts the onion rings into a position in which they already were (regardless of whose turn it was) what s the deepest that a game tree will be? Answer: The onion configuration graph looks like this: N / \ * * / \ * * / \ / \ H * * V where N is the start state, and H and V are the cases where all the rings are on Home s and Visitor s poles, respectively From this, we see that the longest path that ends when it gets to H or V is 8 nodes So, the deepest the search tree will be is 8 nodes (or 7 edges)

DISCRETE STRUCTURES FINAL EXAM FALL 2005, SECTION 0201 (PICKETT) 7 (5) (50 points) Using only the following symbols a, b, (, ), F, and = (where F is always false), construct an expression that s equivalent to a b (thus proving that implies and False make a universal boolean operator set) Answer: Here s one way to do it a b = b = (a = F)

8 DISCRETE STRUCTURES FINAL EXAM FALL 2005, SECTION 0201 (PICKETT) () (100 points total) Consider the grammar G with starting nonterminal <S>: <S> ::= A<S> B<S> <M> <M> ::= AAA B (a) (10 points) Is the string AAABABBABAA in G s language? Answer: No, G s language is all the strings over A and B that end in AAA or B (b) (10 points) Is the string ABBBABABBAAA in G s language? Answer: Yes (c) (40 points) Draw the parse tree for the string AAAA Answer: <S> / \ A <S> <M> AAA (d) (40 points) Is G regular? That is, is there a regular expression that has the same language as G? Either prove that G is not regular, or give a regular expression that has the same language as G Answer: Yes, the regular expression is (A B)*(B AAA)

DISCRETE STRUCTURES FINAL EXAM FALL 2005, SECTION 0201 (PICKETT) 9 (7) (100 points) How many different programs are there for a Turing machine with n states (and that have 3 characters A, B, and # (the blank character))? You can assume that the start state is always state 1, and 2 programs that are functionally equivalent are still considered different programs (Hint, such a Turing machine will have 3n lines) and For simplicity, follow the syntax below, and count these 2 lines as different: In state and reading write move and goto state 2 # A Right halt In state and reading write move and goto state 2 # A Left halt Ie, the reader head must always have a left or right instruction and halt is a special state transition that causes the machine to halt (If you have problems with a general equation for n state Turing machines, you may give an answer for a 1 state Turing machine for partial credit) Also don t worry about state reachability (that would be incomputable) Answer: There are 3 lines for every state, which gives 3n lines In each of these lines, what to write, move, and which state to goto can all vary There are 3 possible symbols to write, 2 possible directions to move and n + 1 possible states to goto (including halt) This gives 3 2 (n + 1) = (n + 1) combinations for each line So there are ( (n + 1)) 3n possible Turing machines with n states So, there are ( (1 + 1)) 3 = 1, 738 single state Turing machines

10 DISCRETE STRUCTURES FINAL EXAM FALL 2005, SECTION 0201 (PICKETT) (8) (10 BONUS points total) (a) (5 BONUS points) Briefly, what s the relationship between Aunt Hillary and Johant Sebastiant Fermant (These are the 2 ant hills that the Anteater discusses in Ant Fugue Recall that Aunt Hillary is the younger ant hill, and Johant Sebastiant Ant is deceased )? Answer: Aunt Hillary was originally made of the same ants that comprised JSF at the time of his demise (b) (5 BONUS points) How is an ant hill (like Aunt Hillary) like a traffic jam or a glider in Conway s Game of Life? Answer: Ant hills are different from a collection of ants (since ants may come and go) just as traffic jams are different from the cars that comprise them (since cars enter and leave the traffic jam), and gliders are separate from the automata that make them up (since no single automaton is part of the glider for more than a few clock cycles)