Category : Pascal Source Code
Archive   : GENERICS.ZIP
Filename : TESTHEAP.PAS

 
Output of file : TESTHEAP.PAS contained in archive : GENERICS.ZIP
Program TestHeap; {Test program for descendants of Linked Generic Heaps}

{Linked Heaps
incur an overhead penalty of 14 (+Elementsize) bytes for EACH ELEMENT!}

Uses L_Heaps,NodeSort;

Var
A : L_IntHeap;
B : L_IntHeap;
I : Integer;
J : Integer;

Begin

Randomize;
A.Create;
B.Create;
A.Init;

For I := 1 to 12 do
Begin
J := Random (10000);
WriteLn ('Sifting Up List Element ',I,' which is ',J:6);
A.SiftUp(J)
End;

B.Copy (A);
A.Sort;

For I := 1 to A.CurrentLength do
Begin
J := A.Retrieve (I);
Write ('Sorted Element ',I:3,' is ',J:6);
J := B.Retrieve (I);
WriteLn (' Heaped Element was ',J:6)
End;

A.Destroy;
B.Destroy;

ReadLn;
End.



  3 Responses to “Category : Pascal Source Code
Archive   : GENERICS.ZIP
Filename : TESTHEAP.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/