h2-sol - Homework 2 Solutions Fundamental Algorithms,...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Homework 2 Solutions Fundamental Algorithms, Spring 2008, Professor Yap Due: Wed Feb 20, in class. HOMEWORK with SOLUTION, prepared by Instructor and T.A.s INSTRUCTIONS: • Please read questions carefully. When in doubt, please ask. You may also post general questions to the homework discussion forum in class website. Also, bring your questions to recitation on Monday. • There are links from the homework page to the old homeworks from previous classes, including solu- tions. Feel free to study these. 1. (4 Points) Exercise A.3 in Lecture 1. (De Morgan’s Law applied to quantifiers) Consider the following sentence: ( ∀ x ∈ Z )( ∃ y ∈ R )( ∃ z ∈ R ) h ( x > 0) ⇒ (( y < x < y- 1 ) ∧ ( z < x < z 2 ) ∧ ( y < z )) i (1) Note that the range of variable x is Z , not R . This is called a universal sentence because the leading quantifier is the universal quantifier ( ∀ ). Similarly, we have existential sentence . (i) Negate the sentence (1), and then apply De Morgan’s law to rewrite the result as an existential sentence. (ii) Give a counter example to (1). (iii) By changing the clause “( x > 0)”, make the sentence true. Indicate why it would be true. SOLUTION: (i) ( ∃ x ∈ Z )( ∀ y ∈ R )( ∀ z ∈ R ) bracketleftbig ( x > 0) ∧ ( ¬ ( y < x < y − 1 ) ∨ ¬ ( z < x < z 2 ) ∨ ( z ≤ y )) bracketrightbig (ii) A counter example is x = 1. If z < x , then we must have z < 1 and so z 2 < z . Now, z must be positive, as otherwise, it would not satisfy the condition y < z . Hence < z < 1. Thus ( z < x < z 2 ) cannot hold. (iii) We change ( x > 0) to ( x > 1). This removes the counter example. Nor we can always choose z so that ( z < x < z 2 ). Now if we choose a positive y sufficiently small, we can also satisfy the remaining clauses. 2. (10 Points) Exercise 7.6, Lecture 1. (Redoing question from hw1, with new assumptions) Provide either a counter-example when false or a proof when true. The base b of logarithms is arbi- trary but fixed, and b > 1. Unlike in hw1, we now assume the functions f,g are unbounded and ≥ eventually. (a) f = O ( g ) implies g = O ( f ). (b) max { f,g } = Θ( f + g ). (c) If g > 1 and f = O ( g ) then ln f = O (ln g ). HINT: careful! (d) f = O ( g ) implies f ◦ log = O ( g ◦ log). Assume that g ◦ log and f ◦ log are complexity functions. (e) f = O ( g ) implies 2 f = O (2 g ). (f) f = o ( g ) implies 2 f = O (2 g ). (g) f = O ( f 2 ). (h) f ( n ) = Θ( f ( n/ 2)). 1 SOLUTION: Many false statements are now true: (a) False, as before. (b) True. max( f,g ) ≤ f + g (ev), since both functions are ≥ 0 (ev). But f + g ≤ 2max( f,g ) (ev). (c) True. Since f = O ( g ), we have f ≤ Cg (ev) for some C > 1. So lg f ≤ lg C + lg g ....
View Full Document

This note was uploaded on 05/11/2010 for the course COMPUTER S 301 taught by Professor . during the Spring '10 term at Kadir Has Üniversitesi.

Page1 / 6

h2-sol - Homework 2 Solutions Fundamental Algorithms,...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online