Question: Computing the exponent of a number ( i . e . , nk ) can take O ( n ) time if done by simply
Computing the exponent of a number ie nk can take On time if done by simply multiplying by n k number of times. A logarithmic way for computing exponents is by using the idea of successive squaring. For instance, rather than computing n as: n n n n n n n n we can compute it by repeatedly squaring, beginning with n computing n n and finally n In general, the algorithm would do the following:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
