Professional Documents
Culture Documents
Program
Program
Program
#include <iostream>
int H[50];
return (i - 1) / 2;
i = parent(i);
{
int maxIndex = i;
int l = leftChild(i);
maxIndex = l;
int r = rightChild(i);
maxIndex = r;
if (i != maxIndex) {
swap(H[i], H[maxIndex]);
shiftDown(maxIndex);
size = size + 1;
H[size] = p;
H[0] = H[size];
size = size - 1;
H[i] = H[i]-p;
if (p < oldp) {
shiftUp(i);
else {
shiftDown(i);
return H[0];
H[i] = getMax() + 1;
shiftUp(i);
int main()
insert(3);
insert(3);
insert(7);
insert(4);
insert(5);
insert(10);
insert(9);
int i = 0;
i++;
int j = 0;
j++;
remove(0);
int l = 0;
decrement_all(H[l],0 );
l++;
return 0;}
Output