1.

What is the complexity of this algorithm? Algorithm Sum (a,n) { s := 0.0; for i := 1 to n do s := s + a [i]; return s;

A. log2n
B. O(n)
C. O(n log n)
D. O(kn)
Answer» C. O(n log n)


Discussion

No Comment Found

Related MCQs