a. Consider the ordinary paper and pencil algorithm for long division: dividing a by b, which yields

Question:

a. Consider the ordinary "paper and pencil" algorithm for long division: dividing a by b, which yields a quotient q and remainder r. Show that this method requires O((1 + lg q) lg b) bit operations.

b. Define µ(a, b) = (1 + lg a)(1 + lg b). Show that the number of bit operations performed by EUCLID in reducing the problem of computing gcd(a, b) to that of computing gcd (b, a mod b) is at most c(µ (a, b) − µ (b, a mod b)) for some sufficiently large constant c > 0.

c. Show that EUCLID.a, b) requires O(µ (a, b)) bit operations in general and O(β2) bit operations when applied to two β-bit inputs.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Introduction to Algorithms

ISBN: 978-0262033848

3rd edition

Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest

Question Posted: