Question 4
Suppose that we were to perform a trace of the algorithm that computes the sum of the entries of a matrix (algorithm is provided below) on the matrix. What would the value be for the "sum" variable immediately after the 2,j pass of the loop?
1. Input: A matrix A with integer entries denoted by aij, for integers m and n.
2. Initialize: sum := 0
3. For i starting at 1 up through m:
For j starting at 1 up through n:
sum := sum + aij (This updates the sum to be the old sum plus the current entry)
Output: sum