priqueue - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Operations : Queues : priqueue

priqueue

priority queue functions

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

priqueue[initialize](pq)

priqueue[insert](NewRecord, pq)

priqueue[extract](pq)

Parameters

pq

-

name of the priority queue

NewRecord

-

structure to be inserted in the queue

Description

• 

The initialize function  makes the necessary assignments (side effects) so that the queue pq is initialized with an empty queue. The queue pq is treated as an unbounded array of the inserted records. Additionally, pq0 maintains the number of entries in the queue.

• 

The insert function adds an element to the queue. The queue is a maximum queue, that is, the maximum element is kept on the head of the queue. The criteria for ordering the queue is giving by NewRecord1 and hence this value should exist and be comparable.

• 

The extract function returns the stored record with the highest value (in its first position) and deletes this record from the queue.

• 

Multiple priority queues are allowed.

• 

If inspection alone is desired, the maximum element of the queue is always at pq1.

• 

To use a priqueue function, either define that specific function alone by the command with(priqueue,function), or define all priqueue functions by the command with(priqueue).

Examples

withpriqueue:

initializeDailyTemps

0

(1)

insert14,Apr30,DailyTemps

insert24,May4,DailyTemps

extractDailyTemps

24,May4

(2)

extractDailyTemps

14,Apr30

(3)

See Also

heap

queue

stack

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam