Question

) Consider the following algorithm procedure polynomial (c, a0,a1, …, an)               power :=1               y≔a0...

  1. ) Consider the following algorithm

procedure polynomial (c, a0,a1, …, an)

              power :=1

              ya0

              for i=1 to n

                             powerpower*c

                             yy+ai*power

              return y

Find a big-O estimate for the number of additions and multiplications used by this algorithm.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

This algorithm uses exactly n additions(Last line of for loop) and 2n multiplications (Once in each line of the for loop).

Big O notation should represent the growth rate of the function in the algorithm as per the input size (Here it is 'n').

Therefore, the complexity of this algorithm is O(n) which is polynomial time.

Add a comment
Know the answer?
Add Answer to:
) Consider the following algorithm procedure polynomial (c, a0,a1, …, an)               power :=1               y≔a0...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT