冒泡法

for i := 0 to PtCount - 1 do
begin
for j := 0 to PtCount-i - 2 do
begin
TempP:=Pts[j];
if Pts[j].Y < Pts[j+1].Y then
begin
Pts[j]:= Pts[j+1];
Pts[j+1]:= TempP;
end;
end;
end;

原文地址:https://www.cnblogs.com/jeenmablog/p/12067564.html