-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpriorityQueue.h
More file actions
34 lines (26 loc) · 962 Bytes
/
Copy pathpriorityQueue.h
File metadata and controls
34 lines (26 loc) · 962 Bytes
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
#ifndef _priorityQueue_h
#define _priorityQueue_h
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include "event.h"
typedef Event* priorityQueueType;
typedef struct PQNode
{
priorityQueueType qt; //priorityQueueType contained in this node
int priority; //priority of node contained in this node
struct PQNode *pNext; //pointer to the next node in the linked list
} PQNode;
typedef struct PriorityQueue
{
PQNode *qFront; //pointer to the first element of the queue
PQNode *qRear; //pointer to the last element of the queue
} PriorityQueue;
PriorityQueue *createPQ( );
void freePQ( PriorityQueue *pq );
int getFrontPriority( PriorityQueue *pq );
priorityQueueType getNextPQ( PriorityQueue *pq );
priorityQueueType dequeuePQ( PriorityQueue *pq );
void enqueueByPriority( PriorityQueue *pq, priorityQueueType qt, int priority );
bool isEmptyPQ( PriorityQueue *pq );
#endif