File: mheap.h

package info (click to toggle)
glam2 1064-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 956 kB
  • sloc: ansic: 6,925; xml: 757; asm: 74; makefile: 54; sh: 11
file content (43 lines) | stat: -rw-r--r-- 1,370 bytes parent folder | download | duplicates (4)
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
43
#if !defined (MMHEAP)
#define	MMHEAP
#include "afnio.h"
#include "dheap.h"
#include "stdinc.h"
/*************************** ADT MMHEAP ***************************
	
	min-max heap

**********************************************************************/

/*************************** MMHEAP type **************************/
typedef struct {
	dh_type		heap;		/* minheap */
	dh_type		maxheap;	/* maxheap */
	long		hpsz;		/* heap size */
	long		nfree;		/* #items available */
	long		*avail;		/* list of available item no */
} mheap_type;

typedef mheap_type *mh_type;

/******************************* private *****************************/

/******************************* Public ******************************/
/***************************** operations ****************************/
mh_type Mheap(long hpsz, long d);
long	DelMinMheap(mh_type H);
long	DelMaxMheap(mh_type H);
long	RmMheap(long i, mh_type H);
long	InsertMheap(keytyp key, mh_type H);
mh_type	NilMheap(mh_type H);

/**************************** macro operations **********************/
#define ItemsInMheap(H)		ItemsInHeap((H)->heap)
#define MinKeyMheap(H)		minkeyHeap((H)->heap)
#define MinItemMheap(H)		minItemHeap((H)->heap)
#define MaxKeyMheap(H)		(-minkeyHeap((H)->maxheap))
#define EmptyMheap(H)		emptyHeap((H)->heap)
#define SizeMheap(H)		((H)->hpsz)
#define FullMheap(H)		fullHeap((H)->heap)
#endif