原书出处
Introduction to Algorithms, Fourth Edition
31 第31章 数论算法
) mod n 6 else d = MODULAR-EXPONENTIATION(a, b − 1, n) // b is odd 7 return (a · d) mod n
The total number of recursive calls depends on the number of bits of b and the values of these bits. Assume that b > 0 and that the most significant bit of b is a 1. Each 0 generates one recursive call (in line 4), and each 1 generates two recursive calls (one in line 6 followed by one in line 4 because if b is odd, then b − 1 is even). If the inputs a, b, and n are β-bit numbers, then there are between β and 2β − 1
recursive calls altogether, the total number of arithmetic operations required is O(β), a
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Introduction to Algorithms, Fourth Edition/_epub-src/OEBPS/chapter031.xhtml
EPUB SHA-256:ec7ced04bb875b93983816aef7a667855a4b71c5cf53b63406b9439c74e27aea