Functions and structures for implementing a minimizing priority queue.
More...
#include <stdlib.h>
Functions and structures for implementing a minimizing priority queue.
Copyright (C) 2006-2010 Rob Hess hess@.nosp@m.eecs.nosp@m..oreg.nosp@m.onst.nosp@m.ate.e.nosp@m.du
- Version
- 1.1.2-20100521
◆ 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_get_min()
void* minpq_get_min |
( |
struct min_pq * |
min_pq | ) |
|
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_extract_min()
void* minpq_extract_min |
( |
struct min_pq * |
min_pq | ) |
|
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_release()
void minpq_release |
( |
struct min_pq ** |
min_pq | ) |
|
De-allocates the memory held by a minimizing priorioty queue.
- Parameters
-
min_pq | pointer to a minimizing priority queue |