Loop Invariants - Discrete Math - Lecture Slides, Slides for Discrete Mathematics. Allahabad University

Discrete Mathematics

Description: Some concept of Discrete Math are Unique Path, Addition Rule, Clay Mathematics, Complexity Theory, Correspondence Principle, Discrete Mathematics, Group Theory, Random Variable, Major Concepts. Main points of this lecture are: Loop Invariants, Simple, Examples, Involve, Selection Sort, Further Information, Loop Invariant, Inductive, Statement, Loop Invariant
Showing pages  1  -  4  of  56
Discrete aths
to show the use of induction for proving properties of code involving loops
use induction to prove that functions work
introduce pre- and post- conditions,
loop termination
2. Loop Invariants
1. What is a Loop Invariant?
2. Three simple examples
they involve while loops
3. Selection Sort
4. Further Information
1. What is a Loop Invariant?
A loop invariant is an inductive statement
which says something which is always true
about a program loop.
Loop invariants are useful for:
code specification
A loop invariant is typically written as an
inductive statement S(n), where n is some
changing element of the loop. For
the loop counter/index
a loop variable which changes on each
The preview of this document ends here! Please or to read the full document or to download it.
Document information
Embed this document:
Docsity is not optimized for the browser you're using. In order to have a better experience please switch to Google Chrome, Firefox, Internet Explorer 9+ or Safari! Download Google Chrome