Go to the documentation of this file.
37 return (
index << 1) | 1;
48 return (
index << 1) + 2;
81 while (at < heap->len) {
86 if (left >= heap->
len)
91 if (right < heap->len) {
103 if (val[0] <= (minchild == left ? val[1] : val[2]))
105 void *
tmp = heap->
arr[at];
106 heap->
arr[at] = heap->
arr[minchild];
107 heap->
arr[minchild] =
tmp;
133 newheap->
arr =
static_cast<void **
>(malloc(amt *
sizeof(
void *)));
189 int at = heap->
len++;
192 heap->
arr[at] = heap->
arr[parent];
212 void *removed = heap->
arr[0];
230 for (
int i = 0; i < to_free->
len; ++i)
static int minheap_get_parent(int index)
int(* get_measure)(const void *)
static void minheap_normalize(MinHeap *heap)
void minheap_free(MinHeap *to_free)
MinHeap * minheap_init(int amt, int(*measure_func)(const void *), void(*cleanup_func)(void *))
void fatal(enum fatal_error err)
void * minheap_remove(MinHeap *heap)
void minheap_init_static(MinHeap *heap, void **arr, int amt, int(*measure_func)(const void *))
void(* element_cleanup)(void *)
static int minheap_get_right(int index)
int minheap_insert(MinHeap *heap, void *ob)
static int minheap_get_left(int index)