HEAP(C语言泛型版)
2012-05-15 09:48:07 来源:WEB开发网核心提示:#include <stdlib.h>#ifndef HEAP_H#define HRAP_Htypedef struct Heap_ { int size; int (*cmp) (const void *, const void *); void (*destroy)(void *);
#include <stdlib.h> #ifndef HEAP_H #define HRAP_H typedef struct Heap_ { int size; int (*cmp) (const void *, const void *); void (*destroy)(void *); void **tree; } Heap; void heap_init( Heap *heap, int (*cmp)(const void *, const void *), void (*destroy)(void *)); void heap_dealloc(Heap *heap); int heap_insert(Heap *heap, const void *data); int heap_extract(Heap *heap, void **data); #define heap_size(heap) ((heap)->size) #endif
更多精彩
赞助商链接