Question: Task 2: Write one brief paragraph, in which you explain in your own words what the clever insight is that allows Algorithm4 to solve the


Task 2: Write one brief paragraph, in which you explain in your own words what the clever insight is that allows Algorithm4 to solve the problem in a single for-loop (= single pass over the input). Write plainly, clearly, and concisely. The answers from Task 1 should be helpful. Type or write neatly (!) by hand. 2 3 4 5 * Linear-time maximum contiguous subsequence sum algorithm. */ int maxSubSum4 const vector int>& a ) 1 int maxSum = 0, thisSum = 0; for(int j = 0; j maxSum) maxSum = thisSum; else if( thisSum
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
