25 #define LELY_UTIL_PHEAP_INLINE extern inline
30 static struct pnode *pnode_merge(
33 static struct pnode *pnode_find(
73 while (*pchild != node)
74 pchild = &(*pchild)->
next;
107 if (cmp(n1->
key, n2->
key) < 0) {
120 static struct pnode *
130 node = pnode_merge(node, node->
next, cmp);
131 node = pnode_merge(node,
next, cmp);
137 static struct pnode *
142 for (; node; node = node->
next) {
143 int c = cmp(
key, node->
key);
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.