SUNY Geneseo Department of Mathematics
Thursday, September 17
Math 303
Fall 2015
Prof. Doug Baldwin
![For all i+2 <= k <= j, A[k] > key holds vacuously on 1st iteration and thru updates to A[i+1] and i on susbequent ones](insertloop.png)
times( x, y ) // initial x, y are x0, y0
product = 0
while x > 0 // inv: product + xy = x0y0
if x is even
x = x/2
y = 2 * y
else // x is odd
x = x-1
product = product + y
end of if
end of while
return product