Answer the all parts of the problem below using formal definitions of Big-Oh and
ID: 3741846 • Letter: A
Question
Answer the all parts of the problem below using formal definitions of Big-Oh and include the Properties of Big-Oh Notation in your proof:
1. (a) Use the formal denition of Big-Oh to prove that if f(n) is a function such that 1 = O(f(n)), then square root of (f(n)) = O(f(n))
(b) Use the formal denition of Big-Oh to prove that if f(n) = O(1000000), then f(n) = O(1).
(c) Use the formal denition of Big-Oh to prove that if f(n) = n4 4n3 + 6n2 4n + 1 (suppose to be f(n) = square root of (n^4 - 4n^3 + 6n^2 - 4^n + 1), then f(n) = O(n^2).
Explanation / Answer
Denition of Big Oh: f(n) = O(g(n)) iff there are two positive constants c and n0 such that |f(n)| c|g(n)|for all n n0
a)
Here it is given that f(n) is a function such that 1 = O(f(n)),
Then square root of (f(n)) = square root of 1=1
Hence square root of (f(n)) = O(f(n))
b)
Here f(n) = O(1000000)
Here the function runs in O(1000000) time (or "constant time") relative to its input. That means if the input contains 1 item or 1000000 items, this function would still just require constant time.
Hence f(n) = O(1).
c)
It is given that f(n) = square root of (n^4 - 4n^3 + 6n^2 - 4^n + 1)
Here the largest coefficient is square root of (n^4) Hence f(n) is O(n^2).
We need to find c and n0 such that square root of (n^4 - 4n^3 + 6n^2 - 4^n + 1)
<= cn2
This is true if c>=2 and n0>=1
Hence f(n) is O(g(n)) which is O(n^2).