GATEverse
← GATE CSE 2004

Q82

MCQ2 marks, −0.5

Let A[1,…,n]A[1,\ldots,n] be an array storing a bit (11 or 00) at each location, and f(m)f(m) is a function whose time complexity is Θ(m)\Theta(m). Consider the following program fragment written in a C like language: counter = 0; for (i=1; i<=n; i++) { if (a[i] == 1) counter++; else {f (counter); counter = 0;} } The complexity of this program fragment is

Sign in to save attempts.

Loading…