Giter Club home page Giter Club logo

eip_proofs's Introduction

Blatt 7 (Bubble sort?)

SI := Schleifeninvariante

Innere Schleife
Partielle Korrektheit
SI_j
Alle Elemente in a[:j] sind kleiner als a[j]
SI_0
a[:0] = [] (Ich nehme einfach an, dass nichts immer kleiner ist als irgendwas, bin nicht sicher ob das ganz korrekt ist)
SI_j sei wahr
für ein beliebiges festes j (Induktionsannahme)
SIj+1 (Induktionsschritt)
Wenn es kein Element in a[:j+1]

gibt, das größer ist als a[j+1], dann behält das Element a[j+1] seine Position. Ansonsten wird es solange mit jeweils vorherigen Elementen (also mit Elementen mit decrementierendem Index) vertauscht, bis in a[:j+1] kein größeres Element mehr ist, als das bei a[j+1].

Terminierung
Die Schleife wird ausgeführt, solange j größer als 0 ist. In jeder Iteration wird aber j um 1 verringert. Darum terminiert die Schleife.
Äußere Schleife
Partielle Korrektheit
Die durch die innere Schleife implementierte Abfolge von Vertauschungen wird durch die äußere for-Schleife n-mal durchgeführt, sodass die Liste am Ende sortiert ist.
Terminierung
Die for Schleife iteriert über die Elemente von a. Wenn a endliche Länge hat, terminiert die Schleife immer.

eip_proofs's People

Contributors

schroedingberg avatar

Watchers

James Cloos avatar  avatar

Forkers

jaed42

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.