13 lines
301 B
C
13 lines
301 B
C
#include "../data_structures/heap.h"
|
|
#include "sort_heap.h"
|
|
|
|
void dlos_sort_heap(dlos_Heap *h) {
|
|
int original_size = h->size;
|
|
for (int i = h->size - 1; i > 0; i--) {
|
|
dlos_node_swap(h->arr, 0, i);
|
|
h->size -= 1;
|
|
dlos_sift_down(0, h);
|
|
}
|
|
h->size = original_size;
|
|
}
|