Question: Consider the following algorithm: int j = 1; int k = 1; for (i = 1; i
Consider the following algorithm:
int j = 1;
int k = 1;
for (i = 1; i <= 10; i++)
j = j * 100; consider this a basic operation
for (i = 1; i <= 20; i++)
k = k * 2; consider this a basic operation
What is the running time, T(n)? Give both the exact function T(n), and then give a big- Theta estimate of T(n). Show your work. For example, if T(n) is exactly n2 + 3n, then T(n) is big-Theta of n2. Show your work! (10 pts.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
