Recent questions tagged loop-invariants

0 votes
1 answer
1
How many times is the comparison $i >= n$ performed in the following program?int i = 200 n = 80; main() { while (i >= n) { i = i - 2 n = n + 1 } }
0 votes
1 answer
3
What is loop invariant in general term ? PS: Insertion Sort has loop invariant . We have three things in loop invariant :a. Initializationb.Maintenancec.Termination
4 votes
2 answers
6
8 votes
1 answer
7
8 votes
3 answers
9
Consider the following pseudo-codex:=1; i:=1; while (x <= 1000) begin x:=2^x; i:=i+1; end;What is the value of i at the end of the pseudo-code?4567
24 votes
3 answers
15
To see more, click for the full list of questions or popular tags.