Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the big - O characterisation in terms of n , of the running time of the following code segment? void fn ( int

What is the big-O characterisation in terms of n, of the running time of the following code segment?
void fn(int A[], int n){
if (n ==0){
return;
}
int sum =0;
for (int i =0; i < n; i++){
sum += A[i];
}
fn(A, n /2);
printf("%d
", sum);
}
(a)
O(log n)
(b)
O(n)
(c)
O(n log n)
(d)
O(n^2)
(e)
O(2^n)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions