2) Determine the theta notation for the following algorithm:
i := 1
while (i < n) do
for j := 1 to n do
some code that takes time
end for j
i := i * 2
end while
3) Determine the theta notation for the following algorithm:
i := n
while i > 0 do
j := 1
while j < i do
some code that takes time
j := j * 2
end while
i := i / 2
end while
4) Determine the theta notation for the following algorithm:
i := n
while (i >= 1) do
for j := 1 to i do
for k := 1 to n do
some code that takes time
end for k
end for j
i := i / 2
end while
5) Determine the theta notation for the following algorithm:
for i := 1 to n do
for j := 1 to i do
for k := j to (i + j) do
some code that takes time
end for k
end for j
end for i
6) Determine the theta notation for the following algorithm:
i := n
while i > 0 do
for k = 1 to n do
j := 1
while j < i do
some code that takes time
j := j * 2
end while
end for
i := i / 2
end while