I got an assignment in which I have been restricted to using NumPy’s sum()
function. Although it is an efficient technique to compute the sum of a large
array, I got to know that it may not be the fastest way to sum
a small array. I have written a technique to calculate the sum of array values but I’m not sure it is an efficient way of doing this. I believe there are many alternative approaches available for calculating the sum of an array.
Here’s the approach that I developed: