Question: (20) 1.1.4, modified: Design an algorithm for computing n for any positive integer n. Besides assignment and comparison, your algorithm may only use the four

(20) 1.1.4, modified: Design an algorithm for computing n for any positive integer n. Besides assignment and comparison, your algorithm may only use the four basic arithmetical operations. For full credit it needs to be O(logn) or O(b) for full credit, where b is the number of bits in the binary representation. What this means in practice is that a number "around" a million should take twice as long as "about" 1000 and about two thirds as long as one billion; 1000=210,1,000,000=220,1,000,000,000230. You might think of algorithms you've (probably) learned that run in O(logn) time for inspiration
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
