程序填空题:Percolates down a max-heap
Please fill in the blanks in the program which percolates down a max-heap.
```c++
void PercolateDown( int p, PriorityQueue H )
{
int child;
ElementType Tmp = H->Elements[ p ];
for ( ; p * 2 <= H->Size; p = child ) {
child = p * 2;
if ( child!=H->Size && @@[H->Elements[child+1] > H->Elements [child]](3))
child++;
if ( H->Elements[ child ] > Tmp )
@@[H->Elements[ p ] = H->Elements[ child ]](3); ;
else break;
}
H->Elements[ p ] = Tmp;
```
答案:
第1空:H->Elements[child+1] > H->Elements [child]
第2空:H->Elements[ p ] = H->Elements[ child ]
```c++
void PercolateDown( int p, PriorityQueue H )
{
int child;
ElementType Tmp = H->Elements[ p ];
for ( ; p * 2 <= H->Size; p = child ) {
child = p * 2;
if ( child!=H->Size && @@[H->Elements[child+1] > H->Elements [child]](3))
child++;
if ( H->Elements[ child ] > Tmp )
@@[H->Elements[ p ] = H->Elements[ child ]](3); ;
else break;
}
H->Elements[ p ] = Tmp;
```
答案:
第1空:H->Elements[child+1] > H->Elements [child]
第2空:H->Elements[ p ] = H->Elements[ child ]