Delphi中的三种排序法

来源:百度知道 编辑:UC知道 时间:2024/07/08 17:07:24
老师布置了一道题目
在1-2000范围内,随即选择100个整数,然后对其排序,用三种排序法
我冒泡已经用了,剩下2种,选择排序和快速排序,但我不太懂~~希望哪位达人帖个代码,我参考下,要DELPHI 7的代码,谢谢

看看算法书就行了

我一般用TListBox的实例进行排序
在Delphi中,算法不是那么重要
好多算法都是系统自带的

var
lstSort:TListBox;
i:Integer;
begin
lstSort:=TListBox.Create(nil);
lstSort.Parent:=self;
for i:=1 to 100 do
begin
Randomize;
lstSort.Items.Add(IntToStr(Rnd(2000)+1));
end;
lstSort.Sort:=true;
end;