Y
yuren5340468
Unregistered / Unconfirmed
GUEST, unregistred user!
我在做程序是遇到一个排序问题,排序算法是冒泡法,帮忙看看是 什么错
procedure Tjobmanage.swapsort();
var
I, J, T,flag: Integer;
x: integer;
n:integer;
begin
n:=m_nodemount;//数组中要排序的个数
for I:=0 to n-1 do
//flag:=0;
for j:=n to I-1 do
if m_joblist.r_finishtime>m_joblist[j].r_finishtime then//数组元素是个记录,要比较的是r_finishtime项
begin
x:=m_joblist.r_finishtime;
m_joblist.r_finishtime:= m_joblist[j].r_finishtime;
m_joblist[j].r_finishtime:=x;
end;
我觉得算法没有错,但是老得不到合适的答案
procedure Tjobmanage.swapsort();
var
I, J, T,flag: Integer;
x: integer;
n:integer;
begin
n:=m_nodemount;//数组中要排序的个数
for I:=0 to n-1 do
//flag:=0;
for j:=n to I-1 do
if m_joblist.r_finishtime>m_joblist[j].r_finishtime then//数组元素是个记录,要比较的是r_finishtime项
begin
x:=m_joblist.r_finishtime;
m_joblist.r_finishtime:= m_joblist[j].r_finishtime;
m_joblist[j].r_finishtime:=x;
end;
我觉得算法没有错,但是老得不到合适的答案