Question: as a function of N while running the code on my own laptop. The time increases linearly with the number of digits, so in Big

as a function of N while running the code on my own laptop. The time increases linearly with
the number of digits, so in Big O notation, its performance can be written as O(N).
f) Using time module of Python, evaluate the algorithmic efficiency of your code in part d.
You need to make the similar figure shown above on your computer.
g) How long will running your code for N=107 take? You do not run your code for this
big number of digits! Use extrapolation to estimate the running time. Do you think we need
to improve the performance of our code to execute it for large numbers?
Let's improve the performance of the code. We can express any number in the base-2 numeral
system ("0" and "1"). Any decimal number can be expressed with a series of zeroes and ones (ai) :
Decimal number =??ai2i
For example, 22=124+023+122+121+020. So,22 in the binary system is 10110.
h) Write your own function which takes a decimal number and return the number in the
binary system. Do not use bin() syntax of python.
In part b, you derived that (N)=AN-1(1), so writing N-1 in the binary system,
N-1=??ai2j, we get:
(N)=AN-1(1)=A??aj2j(1)=(A2j)aj(1)=dots(A4)a2(A2)a1(1)
For clarity if we want to find (23), it can be explained as follows:
as a function of N while running the code on my

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 Accounting Questions!