Question

2. Asymptotic Notation (8 points) Show the following using the definitions of O, Ω, and Θ....

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)) )

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Θ 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.

1) Gunen Fsom tin dep, nition of θ(98m) Divide the ive ialy t n h 3 2h3 n h m apprcac

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)) ).

Add a comment
Know the answer?
Add Answer to:
2. Asymptotic Notation (8 points) Show the following using the definitions of O, Ω, and Θ....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT