Mission Base

Program Base Library Functions

int pblPriorityQueueAddLast

( PblPriorityQueue* queue,
  int priority, void* element )

Adds the element with the specified priority to the end of the priority queue without ensuring the heap condition.

Documentation

Adds the element with the specified priority to the end of the priority queue without ensuring the heap condition.

This function has a time complexity of O(1).

This function together with pblPriorityQueueConstruct() can be used to build a priority queue with N elements in time proportional to N.

First create an empty queue with pblPriorityQueueNew() and ensure the queue has space for N elements via a call to pblPriorityQueueEnsureCapacity(), then add all elements via calls to this function and finally ensure the heap condition with a call to pblPriorityQueueConstruct().

Parameters:
queue - The queue to use
priority - Priority of the element to be added
element - Element to be added to the queue
Returns:
int rc >= 0: The size of the queue.
int rc < 0: An error, see pbl_errno:
PBL_ERROR_OUT_OF_MEMORY - Out of memory.

Alphabetic index



This page was generated with the help of DOC++.