Question: 4. You have an idea for a faster program. You scour the Internet and, as luck would have it, you find an algorithm one prime.factor

 4. You have an idea for a faster program. You scour

4. You have an idea for a faster program. You scour the Internet and, as luck would have it, you find an algorithm one prime.factor (N) that, given an 1-digit binary number, N, will find one prime factor of the number in O(na) time. (a) Using this algorithm (as a black box), give an efficient algorithm to factor an 1-digit binary number into primes and print the prime factors). (b) Approximately how many times does your factoring algorithm use the one-prime factor (N) routine in the worst case, as a function of n? (c) How fast is your algorithm in the worst case), in order notation, as a function of n? As above, assume that it takes linear time, i.e. e(n) time, to add, subtract, multiply, and divide two n-digit binary numbers. (d) Is your new program fast enough? Justify. 4. You have an idea for a faster program. You scour the Internet and, as luck would have it, you find an algorithm one prime.factor (N) that, given an 1-digit binary number, N, will find one prime factor of the number in O(na) time. (a) Using this algorithm (as a black box), give an efficient algorithm to factor an 1-digit binary number into primes and print the prime factors). (b) Approximately how many times does your factoring algorithm use the one-prime factor (N) routine in the worst case, as a function of n? (c) How fast is your algorithm in the worst case), in order notation, as a function of n? As above, assume that it takes linear time, i.e. e(n) time, to add, subtract, multiply, and divide two n-digit binary numbers. (d) Is your new program fast enough? Justify

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!