2. Asymptotic Notation (8 points)
Show the following using the definitions of O, Ω, and Θ.
(1) (2 points) 2n 3 + n 2 + 4 ∈ Θ(n 3 )
(2) (2 points) 3n 4 − 9n 2 + 4n ∈ Θ(n 4 ) (Hint: careful with the negative number)
(3) (4 points) Suppose f(n) ∈ O(g1(n)) and f(n) ∈ O(g2(n)).
Which of the following are true? Justify your answers using the definition of O. Give a counter example if it is false.
(a) f(n) ∈ O( 5 · g1(n) + 100 )
(b) f(n) ∈ O( g1(n) + g2(n) )
(c) f(n) ∈ O( g1(n) g2(n) )
(d) f(n) ∈ O( max(g1(n), g2(n)) )
Θ Notation: The
theta notation bounds a functions from above and below, so it
defines exact asymptotic behavior.
A simple way to get Theta notation of an expression is to drop low
order terms and ignore leading constants. For example, consider the
following expression.
3n^3 + 6n^2 + 6000 = Θ(n^3)
Dropping lower order terms is always fine because there will always
be a n0 after which Θ(n^3) has higher values than Θ(n^2)
irrespective of the constants involved.
For a given function g(n), we denote Θ(g(n)) is following set of
functions.
Θ(g(n)) = {f(n): there exist positive constants c1, c2 and n0 such that 0 <= c1*g(n) <= f(n) <= c2*g(n) for all n >= n0}
The above definition means, if f(n) is theta of g(n), then the value f(n) is always between c1*g(n) and c2*g(n) for large values of n (n >= n0). The definition of theta also requires that f(n) must be non-negative for values of n greater than n0.
3)
Big O Notation: The
Big O notation defines an upper bound of an algorithm, it bounds a
function only from above. For example, consider the case of
Insertion Sort. It takes linear time in best case and quadratic
time in worst case. We can safely say that the time complexity of
Insertion sort is O(n^2). Note that O(n^2) also covers linear
time.
If we use Θ notation to represent time complexity of Insertion
sort, we have to use two statements for best and worst cases:
1. The worst case time complexity of Insertion Sort is
Θ(n^2).
2. The best case time complexity of Insertion Sort is Θ(n).
The Big O notation is useful when we only have upper bound on time complexity of an algorithm. Many times we easily find an upper bound by simply looking at the algorithm.
O(g(n)) = { f(n): there exist positive constants c and n0 such that 0 <= f(n) <= cg(n) for all n >= n0}
(a) f(n) ∈ O( 5 · g1(n) + 100 )
Ans) True.
Since f(n) ∈ O(g1(n)), this means that 0 <= f(n) <= cg1(n) for all n >= n0. Clearly, 0 <= f(n) <= c*[5 * g1(n) + 100]. Hence, f(n) ∈ O( 5 · g1(n) + 100 )
b) f(n) ∈ O( g1(n) + g2(n) )
Ans) True.
Since f(n) ∈ O(g1(n)) and f(n) ∈ O(g2(n)), this means that 0 <= f(n) <= c1g1(n) and 0 <= f(n) <= c2g2(n) for all n >= n0.
From this, we can deduce that 0 <= f(n) <= c1g1(n) + c2g2(n), hence, f(n) ∈ O( g1(n) + g2(n) ).
c) f(n) ∈ O( g1(n) g2(n) )
Ans) False
For example, if f(n) = 2*n^2 + 3n + 6 and g1(n) = 2n^2 and g2(n) = 3n^2.
g1(n)*g2(n) = 6n^4
Clearly, f(n) does not belong to O( g1(n) g2(n) ).
d) f(n) ∈ O( max(g1(n), g2(n)) )
Ans) True.
Since f(n) ∈ O(g1(n)) and f(n) ∈ O(g2(n)), this means that 0 <= f(n) <= c1g1(n) and 0 <= f(n) <= c2g2(n) for all n >= n0.
From this, we can deduce that 0 <= f(n) <= max ( c1g1(n), c2g2(n)), hence, f(n) ∈ O( max(g1(n), g2(n)) ).
2. Asymptotic Notation (8 points) Show the following using the definitions of O, Ω, and Θ....
Need help with 1,2,3 thank you. 1. Order of growth (20 points) Order the following functions according to their order of growth from the lowest to the highest. If you think that two functions are of the same order (Le f(n) E Θ(g(n))), put then in the same group. log(n!), n., log log n, logn, n log(n), n2 V, (1)!, 2", n!, 3", 21 2. Asymptotic Notation (20 points) For each pair of functions in the table below, deternme whether...
Growth of functions. Using the definitions of Θ, Ο, and Ω show that: a. 5 − 2 = Θ( ) b. 2 + 6 = O( ) c. 3 = Ω()
Please note n's are superscripted. (a) Use mathematical induction to prove that 2n+1 + 3n+1 ≤ 2 · 4n for all integers n ≥ 3. (b) Let f(n) = 2n+1 + 3n+1 and g(n) = 4n. Using the inequality from part (a) prove that f(n) = O(g(n)). You need to give a rigorous proof derived directly from the definition of O-notation, without using any theorems from class. (First, give a complete statement of the definition. Next, show how f(n) =...
Use the definition of Θ in order to show the following: a. 5n^3 + 2n^2 + 3n = Θ (n^3) b. sqroot (7n^2 + 2n − 8) = Θ( ?)
Example 3: The Growth of Functionsand Asymptotic notation a) Show that x is O(x )but that r is not O(x b) Give as good a big-O estimate as possible for each of the following (A formal proof is not required, but give your reasoning): log,n! 7n n +nlo 3n2 +2n+4 . (n log, (log,n") 2 42" c) Which of the functions in part b) above has the fastest growth rate? d) Show that if f(x) is Ollog, x)where b>1, and...
1. a) Let f(n) = 6n2 - 100n + 44 and g(n) = 0.5n3 . Prove that f(n) = O(g(n)) using the definition of Big-O notation. (You need to find constants c and n0). b) Let f(n) = 3n2 + n and g(n) = 2n2 . Use the definition of big-O notation to prove that f(n) = O(g(n)) (you need to find constants c and n0) and g(n) = O(f(n)) (you need to find constants c and n0). Conclude that...
Asymptotic notation O satisfies the transitive property i.e. if f(n)=O(g(n)) and g(n)=O(h(n)), then f(n)=O(h(n)). Now we know that 2n =O(2n-1), 2n-1 =O(2n-2?),....... , 2i=O(2i-1?),....... So using rule of transitivity, we can write 2n =O(2i-1?).We can go extending this, so that finally 2n =O(2k?), where k is constant.So we can write 2n =O(1?). Do you agree to what has been proved?If not,where is the fallacy? 6 marks (ALGORITHM ANALYSIS AND DESIGN based problem)
Please show work and solve in Asymptotic complexity using big O notation. (8 pts) Assume n is a power of 2. Determine the time complexity function of the loop for (i=1; i<=n; i=2* i) for (j=1; j<=i; j++) {
Use the definition of 0 to show that 5n^5 +4n^4 + 3n^3 + 2n^2 + n 0(n^5).Use the definition of 0 to show that 2n^2 - n+ 3 0(n^2).Let f,g,h : N 1R*. Use the definition of big-Oh to prove that if/(n) 6 0(g{n)) and g(n) 0(h{n)) then/(n) 0(/i(n)). You should use different letters for the constants (i.e. don't use c to denote the constant for each big-Oh).
Not sure what the notation is asking. 1. (10 Points) Fill in the blanks to indicate each statement is True or False for the given fn) and g(n) pairs f(n) = logn g(n) logen f(n) 2(2n) (n)=0(g(n)) fn) og(n)) f(n)=Ω(g(n)) f(n)=(o(g(n)) f(n)-0(g(n))