![]() |
Re: Quicksort (Ausgabe)
...ich hab ma schnell was geschrieben, must du nur noch an deine Ausgabe anpassen.
Delphi-Quellcode:
Tschüß Markus
procedure TForm1.QuickSort(links,rechts:integer);
var i,j,h1,h2: integer; begin i:=links; j:=rechts; h1:=sort[(i+j) div 2]; repeat while sort[i] < h1 do inc(i); while sort[j] > h1 do dec(j); if i<=j then begin h2:=sort[i]; sort[i]:= sort[j]; sort[j]:= h2; SGsortiert.Cells[i-1,1]:=inttostr(Sort[i]); SGsortiert.Cells[j-1,1]:=inttostr(Sort[j]); inc(i); dec(j); end; until i>j; if links<j then Quicksort(links,j); if i<rechts then Quicksort(i,rechts); end; procedure TForm1.Button1Click(Sender: TObject); begin ZahlenEinlesen; QuickSort(1,20); end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:07 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz