Question: Prove that the following recursive algorithm for exponentiation is correct. 123 int power(y, z){ 1. 2. 3. } //return y, where y IR, E

Prove that the following recursive algorithm for exponentiation is correct. 123 int power(y, z){ 1. 2. 3. } //return y, where y IR, E N. if(z ==0)return 1; if(z is odd)return power(y, [2/2])*y; else return power(y, [2/2])
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
