libvieter/src/heap/vieter_heap.c

39 lines
960 B
C
Raw Normal View History

#include "vieter_heap.h"
#include "vieter_heap_tree.h"
#include <stdlib.h>
struct vieter_heap {
vieter_heap_tree *tree;
};
vieter_heap *vieter_heap_init() { return calloc(1, sizeof(vieter_heap)); }
uint64_t vieter_heap_size(vieter_heap *heap) { return 0; }
void vieter_heap_free(vieter_heap *heap) {}
vieter_heap_error vieter_heap_insert(vieter_heap *heap, uint64_t key,
void *data) {
vieter_heap_node *new_node = vieter_heap_node_init();
new_node->key = key;
new_node->data = data;
vieter_heap_tree *new_tree = vieter_heap_tree_init(new_node, NULL, 1);
if (heap->tree == NULL) {
heap->tree = new_tree;
} else {
heap->tree = vieter_heap_tree_merge(heap->tree, new_tree);
}
return vieter_heap_ok;
}
vieter_heap_error vieter_heap_pop(void **out, vieter_heap *heap) {
return vieter_heap_ok;
}
vieter_heap_error vieter_heap_peek(void **out, vieter_heap *heap) {
return vieter_heap_ok;
}