Skip to content
Snippets Groups Projects
Commit 9e2d6bdf authored by Schaller's avatar Schaller
Browse files

InsertionSort hinzugefügt

parent 443ee4ed
No related branches found
No related tags found
No related merge requests found
package Sortieralgorithmen;
/**
* @author Dirk Zechnall
* @version 11.05.2011
*/
import Grundlage.*;
import Analyse.*;
public class InsertionSort extends SortingAlgorithm
{
/**
* Im Konstruktor werden mit der Anzahl der Elemente die Groesse des
* Feldes festgelegt.
* @param int anzahlElemente: Die Anzahl der zu sortierenden Zahlen
*/
public InsertionSort()
{
super();
name = "InsertionSort";
}
/**
* Methoden - Fhigkeiten von Objekten der Klasse Feld
*/
public void sort(){
start();
for(int start = 1; start < reihe.getLaenge(); start++) {
int akt = start;
while(akt >0 && reihe.istInhaltKleiner(akt, akt-1)){
reihe.tauscheInhalteAnPos(akt,akt-1);
akt--;
}
}
stop();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment