运行结果正确
实际上,建堆和删除堆是一样的。
#include<stdio.h>
#include <stdlib.h>
#include <string.h>
#include<malloc.h>
//构造结构堆
typedef struct node *heap;
struct node {
//这是一个数组
int *base;
int max;
int size;
};
//遍历这个堆
void tra(heap h){
for(int i=1;i<=h->size;i++){
printf("%d ",h->base[i]);