Time-Complexity-using-while-and-if
for i = 1 to n do step 2
{
stat;
}
while(condition)
{
stat;
}
do{
}while(condition)
do loop is Posteriori loop,executes statement first then executes condition while loop is prior loop,executes condition first then executes statement
repeat{
stat;
}until(condition)
repeat will always execute if the condition is false do will always execute if the condition is true
i = 0 -> 1
while(i < n){ -> n + 1
stat; -> n
i ++ -> n
}
for(i = 0; i < n; i++) -> n + 1
{
stat; -> n
}
a = 1
while(a < b)
{
stat
a = a * 2
}
i = n
while(i > 1)
{
stat;
i = i /2;
}
same as the previous one