I recently came across a function called the strawman algorithm which the pseudo code looks like this:
StrawmanSubarray(A): Initialize bestsum = A For left=0 to n-1: For right = left to n-1: Compute sum A[left] + . . . + A[right] If sum > bestsum: bestsum = sum
The time complexity is Θ (n^3), and I don’t quite get where is the 3rd n comes from to get Θ (n^3)?