I was going through a past paper question but I don't have any answers to know if I'm working out the problems correctly or not.
I need to find the time complexity for:
i) repeat
n:=n div 2;
until n=1;
ii) for i:=1 to n do
begin
for j:=1 to n do
begin
for k:=1 to n do;
end;
end;
iii) repeat
for i:=1 to n do
begin
for j:=1 to n do;
end;
n:=n div 2
until n=1
In my opinion, the answer for (ii) is $O(\log n)$ and the answer for (ii) is $O(n^3)$ but I'm not sure about my answers. Regarding question (iii) I have no idea how to come up with a solution.