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

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

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

Algorithm efficiency can be measured in terms of: Time Space Other resources such as processors, network packets, etc.

Intro to Theory of Computation

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

CSE 105 Theory of Computation

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

TURING MAHINES

CSE 105 THEORY OF COMPUTATION

1 Showing Recognizability

CSE 105 THEORY OF COMPUTATION

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

CSE 105 Theory of Computation

Theory of Computation

CSE 105 THEORY OF COMPUTATION

V Honors Theory of Computation

Finish K-Complexity, Start Time Complexity

Lecture 16: Time Complexity and P vs NP

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement:

CSE 105 THEORY OF COMPUTATION

Decidability (What, stuff is unsolvable?)

CSE 555 Homework Three Sample Solutions

1 Reducability. CSCC63 Worksheet Reducability. For your reference, A T M is defined to be the language { M, w M accepts w}. Theorem 5.

An analogy from Calculus: limits

ACS2: Decidability Decidability

CSCE 551 Final Exam, Spring 2004 Answer Key

Computability and Complexity

Intro to Theory of Computation

CS 154 Introduction to Automata and Complexity Theory

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

Menu. Lecture 2: Orders of Growth. Predicting Running Time. Order Notation. Predicting Program Properties

COL 352 Introduction to Automata and Theory of Computation Major Exam, Sem II , Max 80, Time 2 hr. Name Entry No. Group

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Theory of Computation

MTAT Introduction to Theoretical Computer Science

6.045 Final Exam Solutions

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

Jane and Joe are measuring the circumference of a dime with a string. Jane' s result is: 55 mm Joe's result is: 58 mm

Great Theoretical Ideas in Computer Science. Lecture 9: Introduction to Computational Complexity

Exam Computability and Complexity

Time Complexity (1) CSCI Spring Original Slides were written by Dr. Frederick W Maier. CSCI 2670 Time Complexity (1)

CS173 Running Time and Big-O. Tandy Warnow

Lecture Notes: The Halting Problem; Reductions

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

Name: Student ID: Instructions:

Theory of Computation p.1/?? Theory of Computation p.2/?? We develop examples of languages that are decidable

CSCE 551 Final Exam, April 28, 2016 Answer Key

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 8 Nancy Lynch

Harvard CS 121 and CSCI E-121 Lecture 20: Polynomial Time

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Decidability (intro.)

Lecture 10: Big-Oh. Doina Precup With many thanks to Prakash Panagaden and Mathieu Blanchette. January 27, 2014

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

CS473 - Algorithms I

CS 361 Meeting 28 11/14/18

Undecidability. We are not so much concerned if you are slow as when you come to a halt. (Chinese Proverb)

acs-07: Decidability Decidability Andreas Karwath und Malte Helmert Informatik Theorie II (A) WS2009/10

Computational Complexity

Turing Machine Recap

Homework Assignment 6 Answers

CSCE 551: Chin-Tser Huang. University of South Carolina

Decidable and undecidable languages

Decidability and Undecidability

Computability Theory

DRAFT. Diagonalization. Chapter 4

Automata and Computability. Solutions to Exercises

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

Theory of Computation

Preparing for the CS 173 (A) Fall 2018 Midterm 1

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

CPSC 421: Tutorial #1

Student#: CISC-462 Exam, December XY, 2017 Page 1 of 12

CSE 105 THEORY OF COMPUTATION

Solutions to Homework Assignment 2

6.045J/18.400J: Automata, Computability and Complexity. Quiz 2. March 30, Please write your name in the upper corner of each page.

Automata and Computability. Solutions to Exercises

Answers to the CSCE 551 Final Exam, April 30, 2008

Hierarchy theorems. Evgenij Thorstensen V18. Evgenij Thorstensen Hierarchy theorems V18 1 / 18

Chap. 4,5 Review. Algorithms created in proofs from prior chapters

Great Theoretical Ideas in Computer Science. Lecture 7: Introduction to Computational Complexity

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

Kolmogorov complexity

DFA to Regular Expressions

} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Decidable Languages - relationship with other classes.

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

EECS 477: Introduction to algorithms. Lecture 5

Complexity Theory Part I

Computation Histories

CS 361 Meeting 26 11/10/17

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes

This chapter covers asymptotic analysis of function growth and big-o notation.

Computational Complexity: A Modern Approach. Draft of a book: Dated January 2007 Comments welcome!

Big-O Notation and Complexity Analysis

Solving and Graphing a Linear Inequality of a Single Variable

Theory of Computation (IX) Yijia Chen Fudan University

3.1 Asymptotic notation

Transcription:

Please give details of your answer. A direct answer without explanation is not counted. Your answers must be in English. Please carefully read problem statements. During the exam you are not allowed to borrow others class notes. Try to work on easier questions first. Problem 1 (10 pts) If we would like to prove f(n) O(g(n)), we need to show the opposite statement of the definition of f(n) = O(g(n)). What is this opposite statement? c > 0, N N, n N such that f(n) > cg(n). Problem 2 (25 pts) Consider the following two functions n 3, if n is odd f(n) = n 2, if n is even n 3, if n is prime g(n) = n 2, if n is composite Which of the following statements are true? (a) f = O(n 2 ) 1

(b) f = O(n 3 ) (c) g = O(n 2 ) (d) g = O(n 3 ) (e) f = O(g) (f) g = O(f) (g) n 2 = O(f) (h) n 3 = O(f) (i) n 2 = O(g) (j) n 3 = O(g) You must prove the result of each sub-problem. If you think the statement is false, you should prove the definition that you wrote for problem 1. Statements (b), (d), (f), (g), (i) are true. (a) For any c > 0, N N, we can let n = an odd number larger than c and N. f(n) = n 3 > cn 2 f O(n 2 ). (b) Let c = 1 and N = 1. cn 3 n 2 cn 3 f(n) f = O(n 3 ). (c) For any c > 0, N N, we can let n = a prime number larger than c and N. g(n) = n 3 > cn 2 g O(n 2 ). 2

(d) Let c = 1 and N = 1. (e) For any c > 0, N N, we can let cn 3 n 2 cn 3 g(n) g = O(n 3 ). n = an odd and composite number larger than c and N. f(n) = n 3 > cg(n) = cn 2 f O(g). (f) Let c = 1 and N = 3. Because all of the prime numbers except 2 are odd, cf(n) = cn 3 g(n) = n 3, when n is prime and n 2 and Therefore, cn 3 cf(n) = cn 2 g(n) = n 2, when n is composite. cf(n) g(n) (g) Let c = 1 and N = 1. g = O(f). cn 3 n 2 cf(n) n 2 n 2 = O(f). (h) For any c > 0, N N, we can let n = an even number larger than c and N. n 3 > cf(n) = cn 2 n 3 O(f). (i) Let c = 1 and N = 1. cn 3 n 2 cg(n) n 2 n 2 = O(g). 3

(j) For any c > 0, N N, we can let n = a composite number larger than c and N. n 3 > cg(n) = cn 2 n 3 O(g). Common Mistakes 1. You cannot have a statement like if n is even, then n 2 = O(n 3 ). Note that big-o is for a function of N N 2. To prove that the statement is false, many write we can find n N such that... if n is composite. If you already find an n, then n may not be composite. 3. Some write no matter f(n) = n 2 or n 3, since n 2 = O(n 2 ) and n 2 = O(n 3 ), then n 2 = O(f). We didn t really have such a statement. You need to prove it by the definition. Problem 3 (20 pts) Assume g(n) n. Consider O(2 f(n) ) and 2 O(f(n)). Do we have g(n) = O(2 f(n) ) g(n) = 2 O(f(n)) or g(n) = 2 O(f(n)) g(n) = O(2 f(n) ) 4

(a) We will show that g(n) = O(2 f(n) ) g(n) = 2 O(f(n)) is true. Proof: Since g(n) n and g(n) = O(2 f(n) ), c 1 > 0, N 1 1, s.t. To prove that g(n) = 2 O(f(n)), we must prove that is true for some c 2 > 0, N 2 N 1. n g(n) c 1 2 f(n), 1, (1) g(n) c 1 2 f(n) 2 c 2f(n), 2. (2) Which means we should prove that c 2 > 1, N 2 N 1 s.t. 2, According to (1), we have log c 1 + f(n) c 2 f(n) f(n) log c 1 c 2 1. log n log c 1 + f(n) f(n) log n log c 1 Therefore, we should prove that c 2 > 1, N 2 N 1, s.t. This is always true when n becomes large. log n log c 1 log c 1 c 2 1 log n c 2 c 2 1 log c 1 So given c 1, N 1, c 2 = 2, N 2 = max{n 1, 4c 1 }, such that (2) is true. Therefore, g(n) = 2 O(f(n)). (b) We will show that g(n) = 2 O(f(n)) g(n) = O(2 f(n) ) 5

is not true. Proof: Let g(n) = 2 2n, f(n) = n. Since g(n) 2 2f(n) for n 1, we have g(n) = 2 O(f(n)). Assume g(n) = O(2 f(n) ). There are c > 0, N 1, such that, 2 2n c 2 n, 2 n c,. However, we can t find a constant c to satisfy 2 n c,, because the left side of the inequality goes to infinity when n. Therefore, there is a contradiction. Common Mistakes 1. In your proof (a), the property g(n) n should be used. 2. Many wrongly have 3. Some write This may not be true. 2 a 2 b = 2 ab. f(n) log n log c f(n) is a strictly increasing function. Problem 4 (20 pts) Consider f(n) = log(1 + e n ) g(n) = n h(n) = n 2 Which of the following statements are true? For small-o, you can directly calculate the limit without getting into the definition of limit. 6

(a) f(n) = O(g(n)) (b) f(n) = o(g(n)) (c) f(n) = O(h(n)) (d) f(n) = o(h(n)) Statement (a),(c),(d) are true. (a) f(n) = log(1 + e n ) < log(2e n ) = log(2) + n 2n, for n 1 c = 2, N = 1, s.t. f(n) cn f(n) = O(n) = O(g(n)). (b) According to L Hospital Rule, f(n) lim n g(n) = lim f (n) n g (n) = lim n e n 1+e n 1 = lim n (1 1 1 + e n ) = 1. Therefore, f(n) o(g(n)) (c) Since n 2 n, from sub-problem (a), c = 2, N = 1 such that f(n) cn cn 2,. Therefore, f(n) = O(h(n)) (d) According to L Hospital Rule, Therefore, f(n) = o(h(n)) f(n) lim n h(n) = lim n e n 1+e n 2n = 0. Common Mistakes 1. Some write log(1 + e n ) lim n n but which basic properties of limit give you this? log(e n ) = lim, n n 7

Problem 5 (5 pts) Is the following language Turing recognizable? Ā T M = { M, w M, w A T M }, where A T M = { M, w M is a TM and accepts w} It is not Turing recognizable. We know that A T M is Turing recognizable but undecidable. (Theorem 4.11) Assume that ĀT M is Turing recognizable. A T M is both co-turing recognizable and Turing recognizable. By Theorem 4.22 in the textbook, A T M is decidable. However, we have proved that A T M is not decidable, so there is a contradiction. Common Mistakes 1. Some write undecidable un-recognizable. This is incorrect. A T M is undecidable, but recognizable. Problem 6 (20 pts) Consider the following language A = { R, S R and S are regular expressions and L(R) L(S)} Is it decidable? Yes, it is decidable. 8

We first observe that L(R) L(S) iff w L(R), w L(S) iff w L(R), w L(S) We can construct a DFA C such that iff L(R) L(S) = L(C) = L(R) L(S) with 1. The conversion of regular expressions to an equivalent NFA (procedures in Theorem 1.54). 2. Constructions for proving closure of regular languages under complementation and intersection. 3. Conversion from NFA to DFA. We can then use Theorem 4.4 to test if L(C) = L(R) L(S) is empty. The following TM F decides A: On input R, S, where R and S are regular expressions. 1. Construct DFA C as described. 2. Run TM T from Theorem 4.4 on input C. 3. If T accepts, accept. If T rejects, reject. 9