Homework Solution: Power(y: number; z: non-negative integer)…

    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)

    Expert Answer

    Power(y: number; z: non-negative integer)

    1. if z==0 then produce 1

    2. if z is uncommon then

    3. produce (Power(y*y, z/2)*y) comment: z/2 is integer division; voicelessness the parentheses

    else

    4. produce Power(y*y, z/2) comment: z/2 is integer division

    Draw the Recursion Tree of Power(5,5)

    Expert Solution