From 4288aa9b66777b9cb8f44f102798e95db88561fa Mon Sep 17 00:00:00 2001 From: tiny656 Date: Wed, 10 Jan 2024 21:30:58 +0800 Subject: [PATCH] update --- .../6-8_Percolate Up and Down (20).c | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/Data Structures and Algorithms (English)/6-8_Percolate Up and Down (20).c b/Data Structures and Algorithms (English)/6-8_Percolate Up and Down (20).c index 2d17f96..21ab64b 100644 --- a/Data Structures and Algorithms (English)/6-8_Percolate Up and Down (20).c +++ b/Data Structures and Algorithms (English)/6-8_Percolate Up and Down (20).c @@ -1,35 +1,3 @@ - -typedef int ElementType; -#define MinData -1 - -typedef struct HeapStruct *PriorityQueue; -struct HeapStruct { - ElementType *Elements; - int Capacity; - int Size; -}; - -PriorityQueue Initialize( int MaxElements ); /* details omitted */ - -void PercolateUp( int p, PriorityQueue H ); -void PercolateDown( int p, PriorityQueue H ); - -void Insert( ElementType X, PriorityQueue H ) -{ - int p = ++H->Size; - H->Elements[p] = X; - PercolateUp( p, H ); -} - -ElementType DeleteMin( PriorityQueue H ) -{ - ElementType MinElement; - MinElement = H->Elements[1]; - H->Elements[1] = H->Elements[H->Size--]; - PercolateDown( 1, H ); - return MinElement; -} - void PercolateUp( int p, PriorityQueue H ) { while (p > 1) { int parent = p / 2;