开始设计

This commit is contained in:
2026-08-10 01:21:15 +08:00
commit e45398991f
228 changed files with 20827 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
#ifndef INCLUDED_C_MAXPQ_H
#define INCLUDED_C_MAXPQ_H
#ifndef INCLUDED_C_BASE_H
#include <c_Base.h>
#endif /*INCLUDED_C_BASE_H*/
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
typedef struct {
void* data; // Flat char pointer block tracking memory slots
c_size_t element_size; // Size of each complex structure element in bytes
c_size_t capacity; // Maximum allocated element capacity
c_size_t size; // Current active element count inside the heap
int (*compar)(const void*, const void*); // Custom comparison rule pointer
} c_MaxPQ_t;
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
c_err_t c_MaxPQ_Init(c_MaxPQ_t* pq, c_size_t initial_capacity, c_size_t element_size,
int (*compar)(const void*, const void*));
void c_MaxPQ_Destroy(c_MaxPQ_t* pq);
c_err_t c_MaxPQ_Push(c_MaxPQ_t* pq, const void* element);
c_err_t c_MaxPQ_Pop(c_MaxPQ_t* pq, void* output_buffer);
void* c_MaxPQ_Peek(c_MaxPQ_t* pq);
c_err_t c_MaxPQ_Clear(c_MaxPQ_t* pq);
c_err_t c_MaxPQ_Resize(c_MaxPQ_t* pq, c_size_t new_capacity);
#endif /*INCLUDED_C_MAXPQ_H*/