Reputation: 582
I'm reading this textbook:
Randal E. Bryant, David R. O’Hallaron - Computer Systems. A Programmer’s Perspective [3rd ed.] (2016, Pearson).
Currently I am unsure about Problem 5.5 in the text book. Below, I have attached a link to the book to make it easier to find.
And this is the answer they give:
Could someone please tell me how the authors arrive at the answer for this question? I am not sure about how they count the number of computations (n additions and 2n multiplications).
Thank you in advance, any help is appreciated :)
Upvotes: 1
Views: 157
Reputation: 107
result += .... is done n times.
and on rhs of line 7 and 8 there are n+n multiplications. It is clearly visible. What is that matter of confusion
Upvotes: 1