Happy new year and peace to you all! Can you please explain to me what is the execution time T(n) of the 2 algorithms? Assuming execution time T(n) = # executions of (a:=a+1)
Algorithm 1:
for i ← 1 to n do
for j ← 1 to i do
for k ← j to i+j do
a ← a + 1
end for
end for
end for
Algorithm 2:
for i ← 1 to m do
for j ← 1 to i^2 do
for k ← 1 to j do
a ← a + 1
end for
end for
end for