Problem1389--Percolate Up and Down

1389: Percolate Up and Down

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 0  Solved: 1
[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

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; };

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