25 #define LELY_UTIL_PHEAP_INLINE extern inline
30 static struct pnode *pnode_merge(
73 while (*
pnode != node)
107 }
else if (c > 0 && node->
child) {
127 if (node == heap->
root)
134 static struct pnode *
143 if (cmp(n1->
key, n2->
key) >= 0) {
144 struct pnode *tmp = n1;
156 static struct pnode *
164 node = pnode_merge(node, node->
next, cmp);
int pheap_contains(const struct pheap *heap, const struct pnode *node)
Checks if a node is part of a pairing heap.
void pheap_insert(struct pheap *heap, struct pnode *node)
Inserts a node into a pairing heap.
struct pnode * pheap_find(const struct pheap *heap, const void *key)
Finds a node in a pairing heap.
void pheap_remove(struct pheap *heap, struct pnode *node)
Removes a node from a pairing heap.
This header file is part of the utilities library; it contains the pairing heap declarations.
int pheap_cmp_t(const void *p1, const void *p2)
The type of a comparison function suitable for use in a paring heap.
This is the internal header file of the utilities library.
pheap_cmp_t * cmp
A pointer to the function used to compare two keys.
struct pnode * root
A pointer to the root node of the heap.
size_t num_nodes
The number of nodes stored in the heap.
A node in a pairing heap.
struct pnode * parent
A pointer to the parent node.
struct pnode * child
A pointer to the first child node.
const void * key
A pointer to the key of this node.
struct pnode * next
A pointer to the next sibling node.