GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
A min/max heap implementation. More...
#include <string.h>
#include <core/gp_debug.h>
#include <core/gp_common.h>
#include <core/gp_compiler.h>
#include <utils/gp_types.h>
Go to the source code of this file.
Functions | |
gp_heap_head * | gp_heap_ins (gp_heap_head *heap, gp_heap_head *elem, int(*cmp)(gp_heap_head *e1, gp_heap_head *e2)) |
Inserts a node into a heap. | |
static gp_heap_head * | gp_heap_rem_last (gp_heap_head *heap, gp_heap_head **last) |
Removes last element on the last level. | |
static gp_heap_head * | gp_heap_pop (gp_heap_head *heap, int(*cmp)(gp_heap_head *e1, gp_heap_head *e2)) |
Removes top element from the heap. | |
static gp_heap_head * | gp_heap_rem (gp_heap_head *heap, gp_heap_head *elem, int(*cmp)(gp_heap_head *e1, gp_heap_head *e2)) |
Removes element from a heap. | |
A min/max heap implementation.
Definition in file gp_heap.h.
gp_heap_head * gp_heap_ins | ( | gp_heap_head * | heap, |
gp_heap_head * | elem, | ||
int(*)(gp_heap_head *e1, gp_heap_head *e2) | cmp | ||
) |
|
inlinestatic |
Removes top element from the heap.
heap | Old heap pointer. |
Definition at line 223 of file gp_heap.h.
References gp_heap_rem_last().
|
inlinestatic |
Removes element from a heap.
Does a buble down on a (sub) heap starting at the removed element and fixes the links afterwards.
heap | An heep tree root. |
elem | An element to be removed. |
cmp | An element comparsion callback. |
Definition at line 280 of file gp_heap.h.
References gp_heap_rem_last().
|
inlinestatic |
Removes last element on the last level.
The head pointer only changes if we remove last element from heap.
heap | A heap pointer. |
last | A pointer to store the last element to. |
Definition at line 172 of file gp_heap.h.
References gp_heap_rem_last().
Referenced by gp_heap_pop(), gp_heap_rem(), and gp_heap_rem_last().