2c03-review - 00088

# 2c03-review - 00088 - g(n)= 0 if n is even n if n is odd...

This preview shows page 1. Sign up to view the full content.

1 CS2MD3. Sample solutions to the assignment 1. Total of this assignment is 132pts. Each assignment is worth 5%. If you think your solution has been marked wrongly, write a short memo stating where marking in wrong and what you think is right, and resubmit to me during class, office hours, or just slip under the door to my office. 1.[8] Prove or disprove the following claims. To disprove c claim, a counterexample is sufficient. Use the definition of from the class and textbook (some books use slightly different definition). 1.[2] There are functions f(n) and g(n) such that f(n)=O(g(n)) and g(n)=O(f(n)). Yes. Let f(n) =n, and g(n)=2n. Clearly, f(n)=O(g(n)) and g(n)=O(f(n)). 2.[2] For any two functions f(n) and g(n), either f(n)=O(g(n)) or g(n)=O(f(n)). No. f(n)= n if n is even 0 if n is odd
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: g(n)= 0 if n is even n if n is odd Clearly, f(n) O(g(n)) and g(n) O(f(n)). 3.[2] For any two functions f(n) and g(n), if f(n)=O(g(n)) then g(n)= Ω (f(n)). Yes. Let f(n)=O(g(n)), there exist c and n such that, when n>n , f(n) ≤ c*g(n). Clearly, g(n) ≥ (1/c)*f(n), when n>n . Thus, there exist c’=(1/c) and n such that g(n) ≥ c’*f(n) for infinite number of n>n , hence, g(n)= Ω (f(n)). 4.[2] For any two functions f(n) and g(n), if f(n)= Ω (g(n)) then g(n)=O(f(n)). No. f(n)= n if n is even 0 if n is odd g(n)= 0 if n is even n if n is odd Let c=1 and n =0. Clearly, f(n) ≥ c*g(n)=0 for infinite number of even numbers. So, f(n)= Ω (g(n)). g(n) ≠ O(f(n)), since for all c and n , if n be an even number greater than n , f(n) c*g(n)=0...
View Full Document

## This note was uploaded on 12/10/2009 for the course CAS 2c03 taught by Professor Janicki during the Spring '03 term at McMaster University.

Ask a homework question - tutors are online