1 |
/* pqueue.h -- Hybrid priority queue with some search functions |
/* pqueue.h -- Hybrid priority queue with some search functions |
2 |
Copyright (C) 2004 Matías Aguirre - Gonzalo Saavedra |
Copyright (C) 2004 - 2005 Matías Aguirre - Gonzalo Saavedra |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
5 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
16 |
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 |
*/ |
*/ |
18 |
|
|
19 |
|
/* |
20 |
|
* Contributions and ideas |
21 |
|
* 2005 - Maximiliano Pin |
22 |
|
*/ |
23 |
|
|
24 |
#ifndef PQUEUE_H |
#ifndef PQUEUE_H |
25 |
#define PQUEUE_H 1 |
#define PQUEUE_H 1 |
26 |
|
|
36 |
#define SZERR -6 |
#define SZERR -6 |
37 |
#define NFOUNDERR -7 |
#define NFOUNDERR -7 |
38 |
|
|
39 |
#define DEFAULT_SZ 100 |
#define DEFAULT_SZ 127 |
40 |
|
|
41 |
#ifndef MAX |
#ifndef MAX |
42 |
# define MAX(A,B) ((A) > (B) ? A : B) |
# define MAX(A,B) ((A) > (B) ? A : B) |
46 |
#endif |
#endif |
47 |
#define PRI_EQ(A,B) ((A) == (B)) |
#define PRI_EQ(A,B) ((A) == (B)) |
48 |
#define MAX_PRI(A,B) (MIN(A,B)) |
#define MAX_PRI(A,B) (MIN(A,B)) |
49 |
#define MAX_PRI_EQ(A,B,C) PRI_EQ(MAX_PRI(A,B),C) |
#define PRI_GREATER(A,B) ((A) < (B)) |
50 |
|
|
51 |
typedef long int prio_t; |
typedef long int prio_t; |
52 |
|
|
70 |
extern void * pq_min(pqueue *); |
extern void * pq_min(pqueue *); |
71 |
extern void * pq_del_min(pqueue *); |
extern void * pq_del_min(pqueue *); |
72 |
extern int pq_empty(pqueue *); |
extern int pq_empty(pqueue *); |
|
extern int pq_requeue(pqueue *); |
|
73 |
extern void * pq_del(prio_t, pqueue *); |
extern void * pq_del(prio_t, pqueue *); |
74 |
extern void * pq_get(prio_t,pqueue *); |
extern void * pq_get(prio_t,pqueue *); |
75 |
extern void * pq_del_func(void*,pqueue*); |
extern void * pq_del_func(void*,pqueue*); |