0

Use the following algorithm to devise an algorithm for computing $a^n$,

enter image description here

Hint: use binary expansion of $n$ to evaluate $a^n$.

The following algorithm is based on the above algorithm to evaluate $a^n$, but I don't see that it does anything extra and I don't see it using the hint too,

enter image description here

Question: We can use both algorithms above to evaluate $a^n$. I don't see how algorithm presented above based on the first algorithm above does answer the question?

Avv
  • 1,159

0 Answers0