|
Data Structures Lerax
1.1.0
Opinionated Data Structures & Algorithms
|
Go to the source code of this file.
Data Structures | |
| struct | PQueueNode |
| A node in the priority queue. More... | |
| struct | PQueue |
| A priority queue implementation using a binary heap. More... | |
Macros | |
| #define | PQUEUE_SIZE 10 |
| #define | PQUEUE_GROWTH_FACTOR 10 |
| #define | HEAP_EMPTY_NODE {.key=-1, .value=-1} |
Typedefs | |
| typedef struct PQueueNode | PQueueNode |
| A node in the priority queue. | |
| typedef enum PQueueType | PQueueType |
| Enum for priority queue type (min or max). | |
| typedef struct PQueue | PQueue |
| A priority queue. | |
Enumerations | |
| enum | PQueueType { MIN_PQUEUE , MAX_PQUEUE } |
| Enum for priority queue type (min or max). More... | |
Functions | |
| PQueue * | pqueue_create (PQueueType type) |
| Creates an empty priority queue. | |
| void | pqueue_insert (PQueue *pq, int key, int value) |
| Inserts an element into the priority queue. | |
| PQueueNode | pqueue_extract (PQueue *pq) |
| Extracts the top element (max for MAX_PQUEUE, min for MIN_PQUEUE) from the priority queue. | |
| void | pqueue_update_key (PQueue *pq, int key, int value) |
| Update the priority of an element in the priority queue. | |
| int | pqueue_get_priority (PQueue *pq, int key) |
| Get the priority of an element in the priority queue. | |
| PQueueNode | pqueue_top (PQueue *pq) |
| Returns the top element (max for MAX_PQUEUE, min for MIN_PQUEUE) in the priority queue without extracting it. | |
| int | pqueue_size (PQueue *pq) |
| Returns the number of elements in the priority queue. | |
| bool | pqueue_is_empty (PQueue *pq) |
| Checks if the priority queue is empty. | |
| void | pqueue_free (PQueue *pq) |
| Frees the memory allocated for a priority queue. | |
| void | pqueue_print (PQueue *pq) |
| Prints the elements of a priority queue to the console. | |
| void | pqueue_println (PQueue *pq) |
| Prints the elements of a priority queue to the console, followed by a newline character. | |
| Iterator * | pqueue_iterator_keys (PQueue *pq) |
| Iterator over keys of priority queue. | |
| Iterator * | pqueue_iterator (PQueue *pq) |
| Iterator over nodes with (key, value) of priority queue. | |
| #define HEAP_EMPTY_NODE {.key=-1, .value=-1} |
| #define PQUEUE_GROWTH_FACTOR 10 |
| #define PQUEUE_SIZE 10 |
Copyright 2017-2025 Manoel Vilela
Author: Manoel Vilela
Contact: manoel_vilela@engineer.com
Organization: UFC
| typedef struct PQueue PQueue |
A priority queue.
| typedef struct PQueueNode PQueueNode |
A node in the priority queue.
| typedef enum PQueueType PQueueType |
Enum for priority queue type (min or max).
| enum PQueueType |