摘要:
GCD is the greatest common divisor. pseudo-code:function Euclid(x,y)if y==0 return x;return Euclid(y, x MOD y).correctness:Euclid's rule: If x and y are positive integers with x >= y, then gcd(x, y) = gcd(x mod y, y).Prove: just to prove gcd(x, y) = gcd(x-y, y). Let GCD is k, then if k can di 阅读全文
摘要:
I have learned two's complement in the computer organization course. At that time, I simply knew that to express a negative number, first find it's positive form, then flip every bit of it and finally add one on it. Although the specific steps are clear, I don't know the reason for it, i 阅读全文