libdacav 0.9.0
/home/dacav/Projects/libdacav/libdacav/dacav/dacavheap.h File Reference

Heap implementation. More...

#include <dacav/dacav.h>
#include <stdlib.h>

Go to the source code of this file.

Typedefs

typedef struct dheap dheap_t
 Opaque type for a heap.

Enumerations

enum  dheap_result_t { DHEAP_SUCCESS = 0, DHEAP_FULL = 1, DHEAP_EMPTY = 2 }
 Return values for heap insertion and extraction functions. More...

Functions

dheap_tdheap_new (size_t size, dcmp_cb_t cmp)
 Constructor for a heap.
void dheap_free (dheap_t *h, dfree_cb_t fc)
 Destructor for a heap.
dheap_result_t dheap_insert (dheap_t *h, void *val)
 Insert procedure.
dheap_result_t dheap_extract (dheap_t *h, void **val)
 Extract the greatest element, than run heapify_down over the values array.
void dheap_heapify_up (void *values[], size_t used, dcmp_cb_t cmp)
 Correct the heapify structure from below.
void dheap_heapify_down (void *values[], size_t used, dcmp_cb_t cmp)
 Move the last element on top, and correct the heapify structure from above.

Detailed Description

Heap implementation.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator