← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 3697.d

二进制最大公约数避开取余

理解等级:中级

二进制GCD利用减法、奇偶测试和折半替代反复求余;偶偶可同时折半并提出公因子2,奇偶可把偶数折半,奇奇可通过差值缩小问题。

原书在习题中要求证明这些恒等式并设计完整算法,此处只保留方法框架。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 第31章 数论算法 · 查看原书依据

      This problem investigates the binary gcd algorithm, which avoids the remainder computations used in Euclid’s algorithm. a. Prove that if a and b are both even, then gcd(a, b) = 2 · gcd(a/2, b/2). b. Prove that if a is odd and b is even, then gcd(a, b) = gcd(a, b/2). c. Prove that if a and b are both odd, then gcd(a, b) = gcd((a – b)/2, b). d. Design an efficient binary gcd

    参考来源

    - 位置:《算法导论(第4版)》第31章《数论算法》(OEBPS/chapter031.xhtml,文本字符[95000,100000))。 - 结论依据:第31章相应定理、习题定义或章末注释;相关图式与来源段落已核对。 - 原始内容:This problem investigates the binary gcd algorithm , which avoids the remainder computations used in Euclid’s algorithm. a. Prove that if a and b are both even, then gcd( a , b ) = 2 · gcd( a /2, b /2). b. Prove that if a is odd and b is even, then gcd( a , b ) = gcd( a , b /2). c. Prove that if a and b are both odd, then gcd( a , b ) = gcd(( a – b )/2, b ). d. Design an efficient binary gcd