Question

In: Computer Science

a) Let T(n) be a running time function defined as T(n) = 3n^2 + 2n +...

a) Let T(n) be a running time function defined as T(n) = 3n^2 + 2n + 5, is this ϴ(n^2 )? Explain prove your answer using the definitions of big-o and omega notations.

b) Solve the following recurrence relations using Master theorem.

a. ?(?) = 3? ( ?/3 ) + ?

b. ?(?) = 5?( ?/2 ) + 2?^2

please help them with both

Solutions

Expert Solution

a) Big-O Notation

1. Suppose M is an algorithm and n is the input size. We can see clearly that complexity of a function f(n) of M increases with n increasing.

2.Suppose There is a function f(n) which is bounded by some multiple of g(n) for almost all n. So, There exists a positive integer n0 and a positive number M suct that for all n>n0 we have

f(n) <= M*g(n) , Then we can write f(n)=O(g(n)).

3. Therefore Big-O Notation is used to define Upper Bound g(n) for any function f(n).

Problem Point of View:

Here consider f(n)=3n^2+2n+5 and g(n)=n^2 which is asymptotic Upper bound for f(n).

So, f(n) <= cg(n) , c>0 and n0>=1

3n^2+2n+5 <= cn^2

Assume c=10, therefore 3n^2+2n+5 <= 10n^2

which proves that f(n)=Og(n^2) as Upper Bound.

Omega Notation

1.f(n) = omega(g(n)), iff there exists a postive integer n0 and a positive number M such that f(n) >= Mg(n) for all n>=n0.

2. Omega Notation is Used to find the Lower Bound g(n) for the function f(n).

Problem Point of View:

We Have to always take greatest lower bound.

so, f(n) >= c.g(n) so according to above line greatest lower bound willl always be n^2.

Therefore, 3n^2+2n+5 >= c.n^2 Here we have to choose the value of c carefully. for this expression to hold true. We can assume c to be 1. to make it hold true.

b) Basically Master Theorem is Used for Certain type of problems That satisfies the rule of

T(n) = aT(n/b)+f(n) where a>=1 and b>1.

So Here is Brief Introduction and Solution to This Question.

It is the Introduction of Master Theorem and now here is the solution to the Question.

For a part n.log(n) where base to log function is 2 is the time complexity of the function.

For b part n^2.32 is the Time complexity for the function.

Happy a Happy Coding!!


Related Solutions

Let An={2-n,2-2n,2-3n,…} where n∈N . Find A3∩A5 , A15∩A21 , A4∩A12 , Ak∩Akl , where k,l∈N...
Let An={2-n,2-2n,2-3n,…} where n∈N . Find A3∩A5 , A15∩A21 , A4∩A12 , Ak∩Akl , where k,l∈N . Prove also that A1∩A2∩A3∩A4∩…=∅ .
Let n be a positive integer. Prove that two numbers n2+3n+6 and n2+2n+7 cannot be prime...
Let n be a positive integer. Prove that two numbers n2+3n+6 and n2+2n+7 cannot be prime at the same time.
Calculate the Big-O time complexity. Show work 1. n^2 + 3n + 2 2. (n^2 +...
Calculate the Big-O time complexity. Show work 1. n^2 + 3n + 2 2. (n^2 + n)(n ^2 + π/2 ) 3. 1 + 2 + 3 + · · · + n − 1 + n
Prove the upper and lower bound of T(n) = T(n/3) + T(2n/3) + O(n)
Prove the upper and lower bound of T(n) = T(n/3) + T(2n/3) + O(n)
For the following program fragment, (1) give an analysis of the running time T(n) as a...
For the following program fragment, (1) give an analysis of the running time T(n) as a function of n and (2) give a big-O bound on the asymptotic running time (tight bounds for full credit). Sum = 0; for (i=0; i< n; i++)    for(j=0; j < i*i; j++) if(j % i == 0) for (k=0; k<j; k++) Sum = Sum + 1;
Derive the Sackur-Tetrode equation starting from the multiplicity givenin Ch. 2: Ω =(1/N!)(V^{N}/h^{3N})(pi^{3N/2}/3N^{2}!)(2mU)^{3N/2} The Sackur-Tetrode equation...
Derive the Sackur-Tetrode equation starting from the multiplicity givenin Ch. 2: Ω =(1/N!)(V^{N}/h^{3N})(pi^{3N/2}/3N^{2}!)(2mU)^{3N/2} The Sackur-Tetrode equation is: S=Nk[ln((V/N)((4pi*m*U)/(3Nh^{2}))^{3/2})+(5/2)]
For f: N x N -> N defined by f(m,n) = 2m-1(2n-1) a) Prove: f is...
For f: N x N -> N defined by f(m,n) = 2m-1(2n-1) a) Prove: f is 1-to-1 b) Prove: f is onto c) Prove {1, 2} x N is countable
Question 2: Calculate the time complexity function T(n) and express it in terms of big-Oh for...
Question 2: Calculate the time complexity function T(n) and express it in terms of big-Oh for the following code: Part a       (hint: make use of sum of geometric progression): for (int i=1; i <= n ; i = i*2) {           for ( j = 1 ; j <= i ; j ++)             {                       cout<<”*”;             } } Part b      (hint: make use of sum of square of a number sequence): for (int i=1; i <= n ; i...
Let f : N → N and g : N → N be the functions defined...
Let f : N → N and g : N → N be the functions defined as ∀k ∈ N f(k) = 2k and g(k) = (k/2 if k is even, (k + 1) /2 if k is odd). (1) Are the functions f and g injective? surjective? bijective? Justify your answers. (2) Give the expressions of the functions g ◦ f and f ◦ g? (3) Are the functions g ◦ f and f ◦ g injective? surjective? bijective?...
1- Show that (n^3+3n^2+3n+1) / (n+1) is O (n2 ). Use the definition and proof of...
1- Show that (n^3+3n^2+3n+1) / (n+1) is O (n2 ). Use the definition and proof of big-O notation. 2- Prove using the definition of Omega notation that either 8 n is Ω (5 n ) or not. please help be with both
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT