微软等数据结构与算法面试100题 第五题(二)

2014-11-24 10:52:31 · 作者: · 浏览: 1
temp = a[index*2+2];
a[index*2+2] = a[index];
a[index] = temp;
}
}
}

}


int maxHeapDelete(int *a, int length)
{

maxHeap(a,length,0);

int temp;

temp = a[length-1];
a[length-1] = a[0];
a[0]=temp;

return a[length-1];

}

int main(){

int a[8]={1, 2, 6, 4, 3, 7, 9, 11};
//maxHeap(a,8,0);
//cout<
int temp;
for(int i=0; i<8;i++)
{
cout< }
//for(int i=0; i<8; i++) cout<
}