Question: Ex . 2 ( a , but done fast ) Suppose you want to calculate the n ^ ( th ) power of a

Ex.2(a", but done fast) Suppose you want to calculate the n ^(th) power of a given number a. Suppose you know a (fix it say to 42), but is an input . Perhaps the first thing you would do is to compute a times a times a etc. for n times. How much time would you spend in this case? (we assume multiplying and addition takes constant time) Can we do better? If yes, how ? If not, why not? (hint: divide and conquer )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!