#ifndef _HEAPSORT_H
#define _HEAPSORT_H

#include <stddef.h>

// max heap,  compa to return <0 if less
void make_heap(void *base,size_t nmemb,size_t size,int (*compa)(const void *,const void *));

// will insert base[nmemb-1]
void push_heap(void *base,size_t nmemb,size_t size,int (*compa)(const void *,const void *));

// removed element will be at base[nmemb-1]
void pop_heap(void *base,size_t nmemb,size_t size,int (*compa)(const void *,const void *));

// no longer a heap...
void sort_heap(void *base,size_t nmemb,size_t size,int (*compa)(const void *,const void *));

#endif
