#include <stdlib.h>
Go to the source code of this file.
◆ MINPQ_INIT_NALLOCD
#define MINPQ_INIT_NALLOCD 512 |
◆ minpq_extract_min()
Removes and returns the element of a minimizing priority queue with the smallest key.
- Parameters
-
min_pq | a minimizing priority queue |
- Returns
- Returns the element of min_pq with the smallest key of NULL if min_pq is empty
◆ minpq_get_min()
Returns the element of a minimizing priority queue with the smallest key without removing it from the queue.
- Parameters
-
min_pq | a minimizing priority queue |
- Returns
- Returns the element of min_pq with the smallest key or NULL if min_pq is empty
◆ minpq_init()
Creates a new minimizing priority queue.
◆ minpq_insert()
int minpq_insert |
( |
struct min_pq * |
min_pq, |
|
|
void * |
data, |
|
|
int |
key |
|
) |
| |
Inserts an element into a minimizing priority queue.
- Parameters
-
min_pq | a minimizing priority queue |
data | the data to be inserted |
key | the key to be associated with data |
- Returns
- Returns 0 on success or 1 on failure.
◆ minpq_release()
De-allocates the memory held by a minimizing priorioty queue.
- Parameters
-
min_pq | pointer to a minimizing priority queue |