Question: For each program block, determine the functions A min (n) and A max (n), which, depending on n, indicate how often statement A is executed
For each program block, determine the functions Amin (n) and Amax (n), which, depending on n, indicate how often statement A is executed when the program is executed. In which complexity class is the function in each case?
a) if n > 100 then Anweisung A;
else
for i?1 to n do
if a[i] > nthen
Anweisung A;
b) for i?1 to n do
for j?i to n do
Anweisung A;
if (j%38 = 0) then
break;
c) for i?1 to n do
j?1;
while (j ? j ? 2n) do
Anweisung A;
j ? j+1;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
