Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

What is the big-O performance estimate of the following function?

What is the big-O performance estimate of the following function?

int f (n) {
int sum = 0;
for (i = 2; i < n; i = i * i)
sum += i;
return sum;
} // end f

Int sum = 0; // runs 1 time
for (i = 2; i < n; i = i * i) // runs log(n) times
sum += i; // runs 1 time for each value of the loop

Need assignment help for this question?

If you need assistance with writing your essay, we are ready to help you!

OUR PROCESS

Order

Payment

Writing

Delivery

Why Choose Us: Cost-efficiency, Plagiarism free, Money Back Guarantee, On-time Delivery, Total Сonfidentiality, 24/7 Support, 100% originality

For n = 10 the loop will execute 2 times, for n = 100 the loop will execute 6 times. Therefore, the total is 1 + log(n) + 1 which is log(n).

“Order a similar paper and get 15% discount on your first order with us
Use the following coupon
“FIRST15”

Order Now