知识卡片

普通读书笔记卡 · 3697.c.1.b

扩展欧几里得回传贝祖系数

理解等级:中级

扩展欧几里得算法除求d=gcd(a,b),还回传x、y使d=ax+by。

若递归子问题给出d=bx′+(a mod b)y′,用a mod b=a−⌊a/b⌋b回代,得到x=y′、y=x′−⌊a/b⌋y′。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

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

      The procedure EXTENDED-EUCLID takes as input a pair of nonnegative integers and returns a triple of the form (d, x, y) that satisfies equation (31.16). As an example, Figure 31.1 traces out the call EXTENDED-EUCLID(99, 78). EXTENDED-EUCLID(a, b) 1 if b == 0 2 return (a, 1, 0) 3 else (d′, x′, y′) = EXTENDED-EUCLID(b, a

    参考来源

    - 位置:《算法导论(第4版)》第31章《数论算法》(OEBPS/chapter031.xhtml,文本字符[20000,25000))。 - 结论依据:原文给出最大公约数递推、扩展算法或模运算群的定义和证明;公式图已核对。 - 原始内容:The procedure E XTENDED -E UCLID takes as input a pair of nonnegative integers and returns a triple of the form ( d , x , y ) that satisfies equation (31.16). As an example, Figure 31.1 traces out the call E XTENDED -E UCLID (99, 78). E XTENDED -E UCLID ( a , b ) 1 if b == 0 2 return ( a , 1, 0) 3 else ( d ′, x ′, y ′) = E XTENDED -E UCLID ( b , a