This is the question-
Let $A[1,....,n]$ ba an array storing a bit $(1\,\,or\,\,0)$ at each location, and $f(m)$ is a function whose time complexity is $\theta(m)$. Consider the following program -
counter = 0;
for( i = 1; i <= n; i++)
{
if(A[i] == 1)
counter++;
else
{
f(counter);
counter = 0;
}
}
Options are :
(A)$\Omega(n^2)$
(B)$\Omega(n\log n)$ and $O(n^2)$
(C)$\Theta(n)$
(D)$\mathcal{O}(n)$
The solution says - "Since it contains only one loop, so compute with linear complexity, hence the complexity will be $\Theta(n)$".
My doubt is, what if the time complexity of the function $f(m)$ was given to be $\theta(2^n)$ or of the order that grows in exponential time? Would the solution given in the book be correct in case of exponential time?