堆的基础操作
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define OK 1
#define ERROR 0
#define TRUE 1
#define FALSE 0
#define OVERFLOW 0
typedef int Status;
typedef int KeyType;
typedef struct{
KeyType key;
}RcdType;
typedef struct{
RcdType *rcd;
int n;
int size;
int tag;
int (*prior)(KeyType,KeyType);
}Heap;
typedef struct{
RcdType *rcd;
int length;
int size;
}RcdSqList;
//函数接口
int greatPrior(int x,int y);
//大顶堆优先函数
int lessPrior(int x,int y);
//小顶堆优先函数
Status swapHeapElem(Heap &H,int i,int j);
//交换堆H中的第i结点和第j结点
void ShiftDown(Heap &H,int pos);
//队堆H中位置为pos的结点做筛选,将以pos为根的子树调整为子堆
Status InitHeap(Heap &H,int size,int tag,int (*prior)(KeyType,KeyType));
//初建最大容量为size的空堆
void MakeHeap(Heap &H,RcdType *E,int n,int size,int tag,int (*prior)(KeyType,KeyType));
//用E建长度为n的堆H,容量为size
Status InserHeap(Heap &H,RcdType e);
//将e插入堆
Status RemoveFirstHeap(Heap &H,RcdType &e);
//删除堆H的堆顶结点,并用e将其返回
Status RemoveHeap(Heap &H,int pos,RcdType &e);
//删除位置pos的结点,并用e返回其值
Status DestroyHeap(Heap &H);
//销毁堆
void HeapSort(RcdSqList &L);
//堆排序
void Print(RcdType *rcd,int length);
//打印函数
int main();
//main函数
int greatPrior(int x,int y