Question: For each pseudo - code below, give the asymptotic running time in Theta notation. You may assume that standard arithmetic operations take Theta

For each pseudo-code below, give the asymptotic running time in \Theta notation. You
may assume that standard arithmetic operations take \Theta (1) time. The 4th part is a bonus part.
CMPSC 465, Fall 2024, HW 11
1.
k :=0;
for i :=1 to n do
for j := i to n do
k := k +1;
end
end
2.
for i :=1 to n do
for j :=1 to n do
k := j;
while k >=1 do
k := k 1;
end
end
end
3.
for i :=1 to n do
j :=1;
while j <= n do
j := j \times 2;
end
end
4.
for i :=1 to n do
j := i;
while j <= n do
j := j + i;
end
end

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!