Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function heapsort(Arr:TIntArray): TIntArray;
- var
- i:Int32;
- data:THeapArrayI;
- begin
- for i:=0 to High(arr) do
- hpush(data, Arr[i], i, True);
- SetLength(Result, Length(Arr));
- for i:=0 to High(arr) do
- Result[i] := hpop(data, True).value;
- end;
- var
- TIA : TIntArray;
- d:Double;
- begin
- TIA := rand.TIA(100,0,10000);
- d := MarkTime();
- TIA := heapsort(TIA);
- WriteLn( MarkTime() - d );
- WriteLn(TIA);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement