Question: Question 2 Consider the following algorithm MYSTERY ( n ) 1 new array s [ 1 . . . n ] 2 s [ 1
Question
Consider the following algorithm
MYSTERYn
new array sn
s
for i to n
si
for p to pfloorsqrtn
if sp
for f p to f floornp
sf p
for i to n
if si
print i
Question a
What is the purpose of lines
Question b
What is the purpose of lines
Question c
What is printed upon execution of MYSTERY
Question d
Rewrite MYSTERY as a recursive program.
Question e
What, in bigO notation, is the time complexity of MYSTERYn
Hint n Ologn
Question f
What is the purpose of the program as a whole?
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
