Find users

Loop Invariants - Discrete Math - Lecture Slides

Slides, Discrete Mathematics

Post: April 27th, 2013
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
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
-
Embed this document

Report Report

Reason:

Send Message

Login or register to download this document!

If you are already registered, login otherwise Register , it just takes 1 minute!

Uploaded by:

emee

emee
Universityuni_20documents_40doc_answris_100
Embed this document
Get the App
Contents
Discrete aths 2. Loop Invariants • Objectives • – to show the use of induction for proving properties of code involving loops – introduce pre- and post- conditions, loop termination use induction to prove that functions work Docsity.com Overview 1. What is a Loop Invariant? 2. Three simple examples 3. Selection Sort 4. Further Information Docsity.com – they involve while loops 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 – debugging continued Docsity.com • A loop invariant is typically written as an inductive statement S(n), where n is some changing element of the loop. For example: – the loop counter/index – a loop variable which changes on each iteration Docsity.com 2.1. Example 1 int square(int val) { int result = 0; int counter = 0; while (counter < val) { result += val; counter++; } return result;..

Docsity.com

Learning becomes social!

Authentication required

This feature is reserved for registered user

Register Login

Docsity.com

Learning becomes social!

Authentication required

Hi!
In order to freely download all the documents on Docsity, please register or login:

Register Login