Loop invariant
•It is the formal relationship between variables in the program.
•It is the formal relationship between variables in the program.
•Three
things are mentioned in loop invariants
•1.
Initialization
–Prior
to the first iteration, i=floor(n/2)
•2.
Maintenance
–Variation
in the value of i
•3.
Termination
–At
termination i=0
No comments:
Post a Comment