/* Priorityqueue. H -- Minimum heap file */<br/> # include "head. H "</P> <p>/* interface function declaration */</P> <p>/* operation: before creating and initializing a priority queue */<br/>/*: ppq points to a priority queue, size is the variable */<br/>/* indicating the priority queue size. If size> 0 & memory allocation is successful, true is returned when the priority queue is created and initialized; otherwise false */<br/>/* time complexity: O (1) */<br/> bool initialize_p (priorityqueue * const ppq, const int size ); </P> <p>/* operation: determines whether a priority queue is empty */<br/>/* before the operation: after ppq points to an initialized priority queue */<br/>/*: If the priority queue is empty, true is returned; otherwise, false */<br/>/* is returned. Time Complexity: O (1) */<br/> bool isempty_p (const priorityqueue * const ppq ); </P> <p>/* operation: determines whether a priority queue is full */<br/>/* before the operation: ppq points to an initialized priority queue */<br/>/*: returns true if the priority queue is full; otherwise false */<br/>/* time complexity: O (1) */<br/> bool isfull_p (const priorityqueue * const ppq ); </P> <p>/* operation: Insert a node into a priority queue */<br/>/* before the operation, ppq points to an initialized priority queue, PN is the node to be added to the queue */<br/>/*: If the priority queue is not full, add the Pn to the priority queue and return true; otherwise false */<br/>/* time complexity: O (log n) */<br/> bool insert_p (const priorityqueue * const ppq, const prioritynode PN ); </P> <p>/* operation: delete and return the smallest node of the data field in the priority queue */<br/>/* before: after ppq points to an initialized priority queue */<br/>/*: If the priority queue is not empty, delete the queue and return the smallest node in the data field; otherwise, null is returned */<br/>/* time complexity: O (log n) */<br/> prioritynode deletemin_p (const priorityqueue * const ppq ); </P> <p>/* operation: add the specified data value of the node in the priority queue */<br/>/* before the operation: ppq points to an initialized priority queue. Position indicates the position. Delta indicates the change quantity */<br/>/* before the operation: If position is the valid position & Delta> 0, add Delta to the position node data in the priority queue and return true; otherwise, false */<br/>/* time complexity: O (log n) */<br/> bool increasekey_p (const priorityqueue * const ppq, const int position, const item delta); </P> <p>/* operation: reduce the specified data value of the node at the specified position in the priority queue */<br/>/* before the operation: ppq points to an initialized priority queue with the position specified position, delta is the change volume */<br/>/* operation: if the position is the valid position & Delta> 0, the data of the position node in the priority queue is reduced by Delta, returns true; otherwise, false */<br/>/* time complexity: O (log n) */<br/> bool decreasekey_p (const priorityqueue * const ppq, const int position, const item delta); </P> <p>/* operation: Release the memory space occupied by a priority queue */<br/>/* operation before: ppq points to an initialized priority queue */<br/>/*: the memory occupied by the priority queue is released */<br/>/* time complexity: O (n) */<br/> void release_p (const priorityqueue * const ppq );