Chapter 2: Problem 21
Given an array Values with \(n\) elements Values[0], Values[1],.... Values \([n-1 \mid\) each containing a real number, the following algorithm finds the sum of all the positive values in Values. Write an invariant for the loop. rollingSum \(=0\) for \(i=\phi, 2, \ldots, n-1\) if Values \([t]>0\) rolling Sum \(=\) rollingSum \(+\) Values \([i]\) Output rollingSum.
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.