Skip to content

Commit 4288aa9

Browse files
committed
update
1 parent 18b7b92 commit 4288aa9

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

Data Structures and Algorithms (English)/6-8_Percolate Up and Down (20).c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,3 @@
1-
2-
typedef int ElementType;
3-
#define MinData -1
4-
5-
typedef struct HeapStruct *PriorityQueue;
6-
struct HeapStruct {
7-
ElementType *Elements;
8-
int Capacity;
9-
int Size;
10-
};
11-
12-
PriorityQueue Initialize( int MaxElements ); /* details omitted */
13-
14-
void PercolateUp( int p, PriorityQueue H );
15-
void PercolateDown( int p, PriorityQueue H );
16-
17-
void Insert( ElementType X, PriorityQueue H )
18-
{
19-
int p = ++H->Size;
20-
H->Elements[p] = X;
21-
PercolateUp( p, H );
22-
}
23-
24-
ElementType DeleteMin( PriorityQueue H )
25-
{
26-
ElementType MinElement;
27-
MinElement = H->Elements[1];
28-
H->Elements[1] = H->Elements[H->Size--];
29-
PercolateDown( 1, H );
30-
return MinElement;
31-
}
32-
331
void PercolateUp( int p, PriorityQueue H ) {
342
while (p > 1) {
353
int parent = p / 2;

0 commit comments

Comments
 (0)