Forum: Object-Pascal / Delphi-Language
Delphi
by DGL-luke,
1. Mai 2006
i didn't say it produced a sorted heap, which in your case would be a MAX-Heap, right? ;)
well, isn't a binary tree just about the same thing? You're right, I'm just 17, and I only took a glance at wikipedia to get the structure of a binary heap.
The rest is merely pointer acrobatics...
Just looked at wikipedia again... "a heap is an abstract data structure, mostly based on trees" (rough...
Forum: Object-Pascal / Delphi-Language
Delphi
by DGL-luke,
1. Mai 2006
A heap can be very easily organized into an array, but if you use binary heaps, this type should be able to help you:
type
PHeapNode = ^THeapNode;
THeapNode = record
Parent,Left,Right: PHeapNode;
Value: Integer;
end;