How many floating point operations are needed to generate a vector using a for-loop: for ("0 to n") v = element(i+1) each element in the vector is : 1/(i^2) Also, how many floating point ops are needed to sum all the elements in a vector using a for loop? looks something like: for(0 to n) sum = sum+i
(number of floating point operations required for 1 iteration) X (number of iterations) In terms of algorithm efficiency, Generating a vector: O(Constant) Sum the vector elements: O(n) is correct according to my knowledge. But if the question asks algo efficiency to "Generate vectors", it is O(n).