int Russian(int a, int b) // implements Russian Peasant Algorithm { int x = a, y = b, z = 0; while (x > 0) { if ( 1 == x % 2) z += y; y <<= 1; x >>= 1; } return z; }
This is the first one we saw. How can we analyze it?