【SortHeapArray】
[code]inputs:MyArray[MaxSize]( numericarrayref ),
int Size( numericsimple ),
int Order( numericsimple ) ;
variables:
int var0( 0 ),
var1( false ) ;
if Size > 1 then
begin
for var0 = IntPortion( Size / 2 ) downto 1
begin
MyArray[0] = MyArray[var0] ;
var1 = HeapSift( MyArray, var0, Size, Order ) ;
end ;
for var0 = Size downto 2
begin
MyArray[0] = MyArray[var0] ;
MyArray[var0] = MyArray[1] ;
var1 = HeapSift( MyArray, 1, var0 - 1, Order ) ;
end ;
end ;
SortHeapArray = true ;
[/code]
页:
[1]