Lesson 1 of 4
Live algorithm trace
Sum one complete array
Complete execution1 of 5
Initialize the running total before reading [4, 1, 3].
1
total = 02
for each x in nums3
total += x4
return totaltotal = 0
Algorithms solve the same task for many input sizes. We call the number of input items n. In this trace, [4, 1, 3] has n = 3. Start total at zero, add each value once, then return after the loop. After every step, total is the sum of the values already visited.
Your call · An array contains 32 values. What is n?