RosettaCodeData/Task/Priority-queue/Component-Pascal/priority-queue-2.component

23 lines
450 B
Text
Raw Permalink Normal View History

2013-10-27 22:24:23 +00:00
DEFINITION PQueues;
2014-01-17 05:32:22 +00:00
IMPORT Boxes;
2013-10-27 22:24:23 +00:00
2014-01-17 05:32:22 +00:00
TYPE
PQueue = POINTER TO RECORD
size-: LONGINT;
(pq: PQueue) IsEmpty (): BOOLEAN, NEW;
(pq: PQueue) Pop (): Rank, NEW;
(pq: PQueue) Push (r: Rank), NEW
END;
2013-10-27 22:24:23 +00:00
2014-01-17 05:32:22 +00:00
Rank = POINTER TO RECORD
p-: LONGINT;
value-: Boxes.Object
END;
2013-10-27 22:24:23 +00:00
2014-01-17 05:32:22 +00:00
PROCEDURE NewPQueue (cap: LONGINT): PQueue;
PROCEDURE NewRank (p: LONGINT; v: Boxes.Object): Rank;
PROCEDURE Test;
2013-10-27 22:24:23 +00:00
END PQueues.