heap.c
void maxHeapifyOnInsert(Heap* heap) {
	int child = heap->size - 1;
	int parent = child % 2 ? (child / 2) : (child / 2) - 1;
	
	while (parent >= 0 && comparePair(heap->vect[child], heap->vect[parent]) > 0) {
		Pair* tmp = heap->vect[parent];
		heap->vect[parent] = heap->vect[child];
		heap->vect[child] = tmp;

		child = parent;
		parent = child % 2 ? (child / 2) : (child / 2) - 1;
	}
}
//insere um novo elemento par na heap e, em seguida, recalcula a heap
insere um novo elemento par na heap e, em seguida, recalcula a heap
insere um novo elemento par na heap e em seguida recalcula a heap
void maxHeapifyOnInsert(Heap* heap) {
	int child = heap->size - 1;
	int parent = child % 2 ? (child / 2) : (child / 2) - 1;
	while (parent >= 0 && comparePair(heap->vect[child], heap->vect[parent]) > 0) {
		Pair* tmp = heap->vect[parent];
		heap->vect[parent] = heap->vect[child];
		heap->vect[child] = tmp;
		child = parent;
		parent = child % 2 ? (child / 2) : (child / 2) - 1;
	}
}
void maxHeapifyOnInsert ( Heap * heap ) { int child = heap -> size - 1 ; int parent = child % 2 ? ( child / 2 ) : ( child / 2 ) - 1 ; while ( parent >= 0 && comparePair ( heap -> vect [ child ] , heap -> vect [ parent ] ) > 0 ) { Pair * tmp = heap -> vect [ parent ] ; heap -> vect [ parent ] = heap -> vect [ child ] ; heap -> vect [ child ] = tmp ; child = parent ; parent = child % 2 ? ( child / 2 ) : ( child / 2 ) - 1 ; } }
insere um novo elemento par na heap e, em seguida, recalcula a heap
insere um novo elemento par na heap e em seguida recalcula a heap