Question: We can test for primes in something like time O ( log ( n ) 1 2 ) . Assume, perhaps unrealistically for anything but
We can test for primes in something like time Ologn
Assume, perhaps unrealistically for anything but the RAM model, that we can compute
n for any n in
time Ologn Assume fn takes time On
Consider the following algorithm,
which takes a positive integer as input:
def functionn:
if isprimen :
return fn
What is the best upper and lower bound you can give on the asymptotic runtime of
the above algorithm,
a assuming LPWC is true? Use OTheta as appropriate.
b assuming LPWC is false? Use OTheta as appropriate.
c assuming LPWC remains unknown? Use OTheta as appropriate.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
