Question: a . ( 1 0 pts ) Prove that if T ( n ) = 8 n 2 + 2 n + 1 5 ,

a.(10 pts) Prove that if T(n)=8n2+2n +15, then T(n)= O(n2). Hint: You need to find two
positive constant values c and n0 such that T(n)<= cn2 for all n >= n0.
b.(10 pts) Suppose the running time of an algorithm is 7n2+22m2+4nm +10m +200,
where n and m are positive integers such that n >= m. Prove that this algorithm is O(n2).
c.(20 pts) Give an analysis of the running time (Big-Oh notation) for the following
algorithms:
Firstly calculate T(n) and then find a tight upper bound (Big-Oh) for each algorithm. You do
not need to provide a proof.
sum =0;
i =0;
while(i < n){
sum+=i;
i+=3;
}
while(i >0){
sum-=i;
i-=2;
}
while(i < sqrt(n)*2){
sum+=i;
i++;
}
i =3*n;
while(i >0){
sum-=i;
i--;
}
print(sum);
sum =0;
i =0;
while (i < n){
j =1;
while (j <= n){
sum +=(i + j);
j++;
}
i*=2;
}
i =0;
while (i <10){
j =1;
while (j <= n){
sum -=(i + j);
j+=2;
}
i++;
}
i =0;
while (i <100000){
sum += i;
i++;
}
print(sum);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!