heap.c
struct MinHeapNode *extractMin(struct MinHeap *minHeap) {
    if (isEmpty(minHeap))
        return NULL;

    struct MinHeapNode *root = minHeap->array[0];

    struct MinHeapNode *lastNode = minHeap->array[minHeap->size - 1];
    minHeap->array[0] = lastNode;

    minHeap->pos[root->v] = minHeap->size - 1;
    minHeap->pos[lastNode->v] = 0;

    --minHeap->size;
    minHeapify(minHeap, 0);

    return root;
}
// Standard function to extract minimum node from heap
Standard function to extract minimum node from heap
Standard function to extract minimum node from heap
struct MinHeapNode *extractMin(struct MinHeap *minHeap) {
    if (isEmpty(minHeap))
        return NULL;
    struct MinHeapNode *root = minHeap->array[0];
    struct MinHeapNode *lastNode = minHeap->array[minHeap->size - 1];
    minHeap->array[0] = lastNode;
    minHeap->pos[root->v] = minHeap->size - 1;
    minHeap->pos[lastNode->v] = 0;
    --minHeap->size;
    minHeapify(minHeap, 0);
    return root;
}
struct MinHeapNode * extractMin ( struct MinHeap * minHeap ) { if ( isEmpty ( minHeap ) ) return NULL ; struct MinHeapNode * root = minHeap -> array [ 0 ] ; struct MinHeapNode * lastNode = minHeap -> array [ minHeap -> size - 1 ] ; minHeap -> array [ 0 ] = lastNode ; minHeap -> pos [ root -> v ] = minHeap -> size - 1 ; minHeap -> pos [ lastNode -> v ] = 0 ; -- minHeap -> size ; minHeapify ( minHeap , 0 ) ; return root ; }
Standard function to extract minimum node from heap
Standard function to extract minimum node from heap