36 lines
1021 B
C
36 lines
1021 B
C
#ifndef INCLUDED_C_MINPQ_H
|
|
#define INCLUDED_C_MINPQ_H
|
|
|
|
#ifndef INCLUDED_C_BASE_H
|
|
#include <c_Base.h>
|
|
#endif /*INCLUDED_C_BASE_H*/
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------------------------ */
|
|
/* */
|
|
|
|
typedef struct {
|
|
void* data;
|
|
c_size_t element_size;
|
|
c_size_t capacity;
|
|
c_size_t size;
|
|
int (*compar)(const void*, const void*);
|
|
} c_MinPQ_t;
|
|
|
|
/* ------------------------------------------------------------------------------------------------------------------ */
|
|
/* */
|
|
|
|
c_err_t c_MinPQ_Init(c_MinPQ_t* pq, c_size_t initial_capacity, c_size_t element_size,
|
|
int (*compar)(const void*, const void*));
|
|
|
|
void c_MinPQ_Destroy(c_MinPQ_t* pq);
|
|
|
|
c_err_t c_MinPQ_Clear(c_MinPQ_t* pq);
|
|
c_err_t c_MinPQ_Resize(c_MinPQ_t* pq, c_size_t new_capacity);
|
|
|
|
c_err_t c_MinPQ_Push(c_MinPQ_t* pq, const void* element);
|
|
c_err_t c_MinPQ_Pop(c_MinPQ_t* pq, void* output_buffer);
|
|
void* c_MinPQ_Peek(c_MinPQ_t* pq);
|
|
|
|
#endif /*INCLUDED_C_MINPQ_H*/
|