Question

In: Computer Science

Question 7 Use the definition of Ω to show that 20(?^3) + 5(n^2) ∈ Ω (?^3)...

Question 7 Use the definition of Ω to show that 20(?^3) + 5(n^2) ∈ Ω (?^3)

Big-O, Omega, Theta complexity of functions, Running time equations of iterative functions & recursive functions,  Substitution method & Master theorem

Please answer within these topics.

Solutions

Expert Solution

i) The Definition of asymptotic Notation Big Omega(Ω) Best Case time Complexity:

A function f(n)=Ω(g(n)) if f(n)>=c g(n) where c>0 and n>=1

Here f(n)=20(n^3) +5(n^2) and g(n)=n^3

So according to definition of Ω: f(n)>=C g(n)

20(n^3) +5(n^2) >= C (n^3) condition will be true for c=1, n>=1

So f(n)>=C g(n)

f(n)=Ω g(n)

ii) The Definition of asymptotic Notation Big O  Worst time Complexity:

A function f(n)=O(g(n)) if f(n)<=c g(n) where c>0 and n>=1

Here f(n)=20(n^3) +5(n^2) and g(n)=n^3

So according to definition of Ω: f(n)<=C g(n)

20(n^3) +5(n^2) <= C (n^3) condition will be true for c=23, n>=2

So f(n)>=C g(n)

f(n)=O g(n)

iii) The Definition of asymptotic Notation Big Theta Average time Complexity:

A function f(n)= θ(g(n)) if C1 g(n) <=f(n)<=C2 g(n) where C1,C2>0 and n>=1

Here f(n)=20(n^3) +5(n^2) and g(n)=n^3

So By Above Big O and Big Omega we can conclude that

C1(n^3) <= 20(n^3) +5(n^2) <= C2 (n^3) condition will be true for C1=1 and C2=23, n>=2

So   C1 g(n) <=f(n)<=C2 g(n)

f(n)=θ g(n)

also when f(n)=O g(n) and  f(n)=Ω g(n) then  f(n)=θ g(n)

iv) Iterative function and recursive function:

A program can be written into two Ways :

i) iterative program: in iterative program we use loops to solve our problem as example given below:

void print(int *d,int n,int n)
{
int i, j;
   for(i=0; i<n; i++) {            // will execute n times
      for(j=0;j<n;j++) {           // will execute n times
         printf("Enter value for d[%d][%d]:", i, j);
         scanf("%d", &d[i][j]);
      }
   }

}

the time complexity of above iterative program is T(n)=O(n^2)

ii) recursive program: in recursive program we use recursive call of same function to solve our problem , it uses stack memory, as example given below:

int A (n)

{

if(n>1)   // condition check constant time C

A(n-1); // recursive Call here

}

the time complexity of above recursive program is T(n)=T(n-1) + C

Substitution Method:

lets take above time complexity :T(n)=T(n-1) + C Base condition n>=1

T(n)=T(n-1) + C ....(1)

T(n-1)=T(n-2) + C   ....(2)

T(n-2)=T(n-3) + C   ....(3)

Substituting the value of 2,3 in equation 1

T(n)=T(n-3) + C +C +C   

T(n)=T(n-k) + kC

Base condition n>=1 put n-k=1

so put, k=n-1

T(n)=T(n-(n-1)) + (n-1)C

T(n)=T(1) + (n-1)C

So T(n)=O(n)

Master Theorm:

This is another way of finding time complexity but here the following condition must satisfy:

it should be in the form of T(n)=a T(n/b) + n^k log ^p n ( where a>=1 , b>1, and K is any real number).

Master theorm given below in image.

Example:

T(n)= 3T(n/2) +n^2

a=3,b=2,k=2

So a<b^k its match to the 3rd Condition of Master theorm shown above.

p=0

SO T(n) = n^k= n^2

let me know if any doubt.


Related Solutions

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
a) Prove that n 3 − 91n 2 − 7n − 14 = Ω(n 3 )....
a) Prove that n 3 − 91n 2 − 7n − 14 = Ω(n 3 ). Your answer must clearly specify the constants c and n0. b) Let g(n) = 27n 2 + 18n and let f(n) = 0.5n 2 − 100. Find positive constants n0, c1 and c2 such that c1f(n) ≤ g(n) ≤ c2f(n) for all n ≥ n0. Be sure to explain how you arrived at the constants.
(a) Find the limit of {(1/(n^(3/2)))-(3/n)+2} and use an epsilon, N argument to show that this...
(a) Find the limit of {(1/(n^(3/2)))-(3/n)+2} and use an epsilon, N argument to show that this is indeed the correct limit. (b) Use an epsilon, N argument to show that {1/(n^(1/2))} converges to 0. (c) Let k be a positive integer. Use an epsilon, N argument to show that {a/(n^(1/k))} converges to 0. (d) Show that if {Xn} converges to x, then the sequence {Xn^3} converges to x^3. This has to be an epsilon, N argument [Hint: Use the difference...
convergent or divergent infinity sigma n = 1 sqrt(n^5+ n^3 -7) / (n^3-n^2+n)
convergent or divergent infinity sigma n = 1 sqrt(n^5+ n^3 -7) / (n^3-n^2+n)
Use this sample data set to answer the next question 2, 3, 5, 7, 9, 10,...
Use this sample data set to answer the next question 2, 3, 5, 7, 9, 10, 14, 15, 16 From this data: Find the mean, median, and mode(s) if any exist. Find the variance and standard deviation of this sample Find the values of Q1, Q2, Q3 and the IQR
A 5th filter is described by the difference equation: 2y(n)=2 x(n)+7 x(n-1)+3 x(n-2)-8 x(n-3)+ x(n-4)-8 x(n-5)+7...
A 5th filter is described by the difference equation: 2y(n)=2 x(n)+7 x(n-1)+3 x(n-2)-8 x(n-3)+ x(n-4)-8 x(n-5)+7 y(n-1)-3 y(n-2)+5y(n-3)- y(n-4) Determine the frequency response. Plot the magnitude and the phase response of this filter. Consider the plot -π≤w≤π for 501 points. Describe the magnitude response (Low pass filter, High Pass filter, etc.) Determine the system stability. Determine the impulse response h(n). You may set the period to -100≤n≤100 Determine the unit step response for -100≤n≤100 . (Matlab)
4) Let ? = {2, 3, 5, 7}, ? = {3, 5, 7}, ? = {1,...
4) Let ? = {2, 3, 5, 7}, ? = {3, 5, 7}, ? = {1, 7}. Answer the following questions, giving reasons for your answers. a) Is ? ⊆ ?? b)Is ? ⊆ ?? c) Is ? ⊂ ?? d) Is ? ⊆ ?? e) Is ? ⊆ ?? 5) Let ? = {1, 3, 4} and ? = {2, 3, 6}. Use set-roster notation to write each of the following sets, and indicate the number of elements in...
Show that is [(n^2) + 2] and [(n^2) - 2] are both primes, then 3 divides...
Show that is [(n^2) + 2] and [(n^2) - 2] are both primes, then 3 divides n
Define the following function f(n) = 5(2^n)-(2^(n-1)), n ≥ 1. Write a recursive definition for the...
Define the following function f(n) = 5(2^n)-(2^(n-1)), n ≥ 1. Write a recursive definition for the function f(n)? Consider the following recurrence: an= 2an-1 + 3 (where a1 = 1). Compute the values of an for n ≤ 5. Find a solution for the recurrence definition and validate its correctness. Consider the following recurrence: an=2an-1 +an-1an-2 (where a1 = 1). Compute the values of an for n ≤ 5.
Find the smallest n ∈ N such that 2(n + 5)^2 < n^3 and call it...
Find the smallest n ∈ N such that 2(n + 5)^2 < n^3 and call it n^0,Show that 2(n + 5)^2 < n^3 for all n ≥ n^0.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT