Problem1995--Percolate Up and Down

1995: Percolate Up and Down

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 0  Solved: 0
[Submit] [Status] [Web Board] [Creator:]

Description

Write the routines to do a

Input

where int p is the position of the element, and PriorityQueue is defined as the following: typedef struct HeapStruct *PriorityQueue; struct HeapStruct { ElementType *Elements; int Capacity; int Size; };

Output

return deleted number and the remaining elements of queue H

Sample Input Copy

9
1 10
1 5
1 2
0
1 9
1 1
1 4
0
0

Sample Output Copy

2 1 4 
Inside H: 5 10 9

Source/Category

157