21 #define MALLOC gmalloc
22 #define REALLOC grealloc
36 for (i = 0; i < ngain+1; i++) (q->
buckets)[i] =
NULL;
39 for (i = 0; i < n+1; i++) (q->
where)[i] =
NULL;
42 for (i = 0; i < n+1; i++) (q->
gain)[i] = -999;
105 if (!q || q->
count <= 0)
return 0;
114 while (gain_max >= 0 && !(q->
buckets)[gain_max]) gain_max--;
134 if (!q || q->
count <= 0)
return 0;
142 while (gain_max >= 0 && !(q->
buckets)[gain_max]) gain_max--;
void DoubleLinkedList_delete(DoubleLinkedList head, void(*linklist_deallocator)(void *))
void DoubleLinkedList_delete_element(DoubleLinkedList l, void(*linklist_deallocator)(void *), DoubleLinkedList *head)
PriorityQueue PriorityQueue_push(PriorityQueue q, int i, int gain)
int PriorityQueue_remove(PriorityQueue q, int i)
DoubleLinkedList DoubleLinkedList_new(void *data)
DoubleLinkedList DoubleLinkedList_prepend(DoubleLinkedList l, void *data)
DoubleLinkedList * buckets
PriorityQueue PriorityQueue_new(int n, int ngain)
int PriorityQueue_pop(PriorityQueue q, int *i, int *gain)
void PriorityQueue_delete(PriorityQueue q)
int PriorityQueue_get_gain(PriorityQueue q, int i)
void * DoubleLinkedList_get_data(DoubleLinkedList l)