osurs
0.0.1
|
Adaptable priority queue data structure. More...
Macros | |
#define | INITIAL_CAPACITY 10 |
Functions | |
PriorityQueue * | priority_queue_create () |
Creates a new priority queue. More... | |
PriorityQueueNode * | priority_queue_add (PriorityQueue *queue, int priority, void *data) |
Adds an element to the priority queue. More... | |
void * | priority_queue_peek (PriorityQueue *queue) |
Returns the data of the element at the front of the priority queue. More... | |
void * | priority_queue_poll (PriorityQueue *queue) |
Removes and returns the data of the element at the front of the priority queue. More... | |
void * | priority_queue_remove (PriorityQueue *queue, PriorityQueueNode *node) |
Removes a specific element from the priority queue, frees the node, and returns its data. More... | |
void | priority_queue_change_priority (PriorityQueue *queue, PriorityQueueNode *node, int new_priority) |
Changes the priority of a specific element in the priority queue. More... | |
void | priority_queue_free (PriorityQueue *queue) |
Frees a priority queue and all of its elements. More... | |
Adaptable priority queue data structure.
#define INITIAL_CAPACITY 10 |
The capacity of the priority queue.
PriorityQueueNode* priority_queue_add | ( | PriorityQueue * | queue, |
int | priority, | ||
void * | data | ||
) |
Adds an element to the priority queue.
queue | The priority queue to add the element to |
priority | The priority of the element being added |
data | The data of the element being added |
void priority_queue_change_priority | ( | PriorityQueue * | queue, |
PriorityQueueNode * | node, | ||
int | new_priority | ||
) |
Changes the priority of a specific element in the priority queue.
queue | The priority queue |
node | The node whose priority is being changed |
new_priority | The new priority of the node |
PriorityQueue* priority_queue_create | ( | ) |
Creates a new priority queue.
void priority_queue_free | ( | PriorityQueue * | queue | ) |
Frees a priority queue and all of its elements.
queue | The priority queue to be freed |
void* priority_queue_peek | ( | PriorityQueue * | queue | ) |
Returns the data of the element at the front of the priority queue.
queue | The priority queue |
void* priority_queue_poll | ( | PriorityQueue * | queue | ) |
Removes and returns the data of the element at the front of the priority queue.
queue | The priority queue |
void* priority_queue_remove | ( | PriorityQueue * | queue, |
PriorityQueueNode * | node | ||
) |
Removes a specific element from the priority queue, frees the node, and returns its data.
queue | The priority queue |
node | The node to remove from the priority queue |