Power(y: number; z: non-negative integer)
1. if z==0 then return 1
2. if z is odd then
3. return (Power(y*y, z/2)*y) comment: z/2 is integer division; note the parentheses
else
4. return Power(y*y, z/2) comment: z/2 is integer division
Draw the Recursion Tree of Power(5,5)
Answer:
Get Answers For Free
Most questions answered within 1 hours.