Hello.
In EPI the problem 17.11 which is to find the max subsum of a circular array.
For each i in n , we are to sweep across the array (up to i, then from i onward)…
The complexity is said to be linear but the solution looks roughly as such:
for (i = 1 -> n)
max[i]=maxSubsumEndingHere + MaxSubsumFromHereToN
Each of those maxSubsum function are O(n) and we do n of them… how can the total time be O(n) and not O(n^2) ?
Thanks.