procedure aktualisieren;
var j: integer;
begin
for j := 1
to 10
do
TEdit(Form1.FindComponent('
Edit' + IntToStr(j))).Text := IntToStr(ss_liste[j]);
end;
procedure markiere (farbe:tcolor;x:integer);
begin
TEdit(Form1.FindComponent('
Edit' + IntToStr(x))).color := farbe;
end;
procedure demarkiere(v:integer);
begin
TEdit(Form1.FindComponent('
Edit' + IntToStr(v))).color := clWindow;
end;
procedure markieren_pivot (z:integer);
begin
TEdit(Form1.FindComponent('
image' + IntToStr(z))).visible := true;
end;
procedure demarkiere_pivot (z:integer);
begin
TEdit(Form1.FindComponent('
image' + IntToStr(z))).visible := false;
end;
procedure Quicksort(
var a:
array of integer; anfang, ende:integer);
var i, l_pos, r_pos, pivot, temp, pivot_feld: integer;
begin
pivot_feld := (anfang+ende)
div 2;
for i := 1
to 10
do demarkiere_pivot(i);
pivot := a[pivot_feld];
markieren_pivot(pivot_feld);
l_pos := anfang;
r_pos := ende;
repeat
while a[l_pos] < pivot
do inc(l_pos);
while a[r_pos] > pivot
do dec(r_pos);
if l_pos < r_pos
then begin
markiere(clRed, l_pos);
markiere(clRed, r_pos);
sleep(1000);
temp := a[l_pos];
a[l_pos] := a[r_pos];
a[r_pos] := temp;
aktualisieren;
markiere(clGreen, l_pos);
markiere(clGreen, r_pos);
sleep(1000);
for i := 1
to 10
do demarkiere(i);
inc(l_pos);
dec(r_pos);
end;
until (l_pos > r_pos) ;
if (anfang < r_pos)
then quicksort(a, anfang, r_pos);
if (l_pos < ende)
then quicksort(a, l_pos, ende);
end;