Mescal
|
Implementation of generic binary heaps. More...
Go to the source code of this file.
Classes | |
struct | binheap |
Type used to represent a binary heap. More... | |
Functions | |
int | fcmp_int (void *x, void *y) |
Comparison function for integers. | |
int | fcmp_uint (void *x, void *y) |
Comparison function for usigned integers. | |
binheap * | create_binheap (int(*)(void *, void *)) |
Creation of an empty binary heap. | |
void | delete_binheap (binheap *) |
Release of a binary heap. | |
bool | isempty_binheap (binheap *) |
Tests if a binary heap is empty. | |
int | getsize_binheap (binheap *) |
Computes the size of of a binary heap. | |
void | push_binheap (binheap *, void *) |
Inserts a new value inside a binary heap. | |
void * | peekmin_binheap (binheap *) |
Computes the minimum value of a binary heap without removing it. | |
void * | popmin_binheap (binheap *) |
Computes the minimum value of a binary heap and removes it. | |
Implementation of generic binary heaps.
binheap * create_binheap | ( | int(* | fc )(void *, void *) | ) |
Creation of an empty binary heap.
fc | The comparison function. |
void delete_binheap | ( | binheap * | p | ) |
Release of a binary heap.
p | The binary heap. |
int fcmp_int | ( | void * | x, |
void * | y ) |
Comparison function for integers.
int fcmp_uint | ( | void * | x, |
void * | y ) |
Comparison function for usigned integers.
int getsize_binheap | ( | binheap * | p | ) |
Computes the size of of a binary heap.
p | The binary heap. |
bool isempty_binheap | ( | binheap * | p | ) |
Tests if a binary heap is empty.
p | The binary heap. |
void * peekmin_binheap | ( | binheap * | p | ) |
Computes the minimum value of a binary heap without removing it.
p | The binary heap. |
void * popmin_binheap | ( | binheap * | p | ) |
Computes the minimum value of a binary heap and removes it.
p | The binary heap. |
void push_binheap | ( | binheap * | p, |
void * | val ) |
Inserts a new value inside a binary heap.
p | The binary heap. |
val | The value. |