Question: 2 . Find the worst - case time complexity of the OpenMystery algorithm below. begin { tabular } { | l | l |

2. Find the worst-case time complexity of the OpenMystery algorithm below. \begin{tabular}{|l|l|}\hline Input: n: positive integer \\1 & Algorithm: OpenMystery \\2 & Let open be a Boolean array of size n \\3 & Initialize open to false \\4 & nopen =0\\5 & for i=1 to n do \\6 & j=i \\7 & while j<=n do \\8 & if open [j] then \\9 & nopen = nopen -1\\10 & else \\11 & nopen = nopen +1\\12 & end \\13 & open [j]= open [j]\\14 & j=j+i \\15 & end \\16 & end \\17 & return nopen \\\hline \end{tabular}

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