Thema: Delphi Sortieralgo

Einzelnen Beitrag anzeigen

Benutzerbild von Rastaman
Rastaman

Registriert seit: 6. Jan 2005
Ort: Lübbecke
575 Beiträge
 
Turbo C++
 
#12

Re: Sortieralgo

  Alt 2. Mär 2005, 18:29
Ohne richtigen Kommentar verstehe ich die Tutorials beim besten Willen nicht.
Ich habe es aber geschafft den langsamsten Sortieralgo der Welt zu schreiben
Er kopiert aus LB1 in LB2 weil ich das mit dem verschieben einfach nich peile

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  i, i2, min2: integer;
  min: String;
begin
For i2 := 0 to ListBox1.Items.Count - 1 do
begin
  min2 := 0;
  min := Listbox1.Items.Strings[0];
  For i := 0 to ListBox1.Items.Count - 1 do
    If i <> ListBox1.Items.Count - 1 then
      If ListBox1.Items.Strings[i + 1] < min then
      begin
        min := ListBox1.Items.Strings[i + 1];
        min2 := i + 1;
      end;
  Listbox2.Items.Add(min);
  ListBox1.Items.Delete(min2);
end;
end;
Chuck Norris has counted to infinity ... twice!
  Mit Zitat antworten Zitat