Please See Question Answer Please Correct M Wrong Big O Performance Estimate Following Fun Q43886875
Please see below for my question and answer. Please correct meif I’m wrong
What is the big-O performance estimate of the followingfunction?
int f (n) {
int sum = 0; ——————–> Setting sum to “0” with a1-time operation. So, O(1)
for (i = 0; i < n; i = i + 10) ——————–> i = 0 =O(1), i < n = O(n), i = i + 10 = O(1). Since O(1) < O(n), =O(n)
sum += i; ——————–> Every loopproduces this iteration. So, O(1)
return sum; ——————-> O(1)
} // end f
Since O(1) < O(n) = total time is O(n)
Expert Answer
Answer to Please see below for my question and answer. Please correct me if I’m wrong What is the big-O performance estimate of th…
OR