-
Notifications
You must be signed in to change notification settings - Fork 0
/
binomialheap.h
42 lines (34 loc) · 939 Bytes
/
binomialheap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// Created by Once on 2019/9/1.
//
#ifndef DATALGORITHM_BINOMIALHEAP_H
#define DATALGORITHM_BINOMIALHEAP_H
#include "list.h"
// 二项堆实现优先队列BinomialHeap
// 数据项
typedef struct area{
int width;
int height;
} Area;
// 结点
typedef struct anode{
int key;
Area value;
int degree;
struct anode *parent, *sibling, *child;
} ANode;
// 二项堆对外ADT
typedef struct binomialheap{
list *list;
int size;
} BinomialHeap;
// 二项堆优先队列操作函数声明
extern BinomialHeap *bheap_init();
extern int bheap_is_full(BinomialHeap *bheap);
extern int bheap_is_empty(BinomialHeap *bheap);
extern int bheap_push(BinomialHeap *bheap, int key, Area *value);
extern ANode *bheap_top(BinomialHeap *bheap);
extern void bheap_pop(BinomialHeap *bheap);
extern void bheap_traverse(BinomialHeap *bheap);
extern int bheap_clear(BinomialHeap *bheap);
#endif //DATALGORITHM_BINOMIALHEAP_H