=========================================================================== CSC 236 Tutorial Exercises for Week 8 Fall 2007 =========================================================================== Prove that the following algorithm is correct, with respect to the conditions given. Precondition: x in R, y in N Postcondition: pow(x,y) returns x^y (with convention 0^0 = 1) pow(x, y): if y == 0: return 1 elif y % 2 == 0: t = pow(x, y/2) return t * t else: t = pow(x, (y-1)/2) return t * t * x