From b3b532bb140ed4a773b2a60618fa8e1075d7acb3 Mon Sep 17 00:00:00 2001 From: bronku Date: Tue, 21 Oct 2025 23:35:07 +0200 Subject: [PATCH] Create heap.h --- heap.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 heap.h diff --git a/heap.h b/heap.h new file mode 100644 index 0000000..00f2bb1 --- /dev/null +++ b/heap.h @@ -0,0 +1,17 @@ +#pragma once + +#include "record.h" + +typedef struct { + record* location; + int g; + int buffer_id; + bool is_blank; +} heap_record; + +// moves elements to maintain heap property +int heapify(heap_record* heap); +// returns the first element, and calls heapify +int heap_pop(heap_record* heap, heap_record* out); +// writes to the last elements, and calls heapify +int heap_pus(heap_record* heap, heap_record* in);