-
Notifications
You must be signed in to change notification settings - Fork 0
/
PriorityQueue.c
54 lines (45 loc) · 1003 Bytes
/
PriorityQueue.c
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
44
45
46
47
48
49
50
51
52
53
54
/*
* COMP2521 - Data Structures and Algorithms
* Assignment 2 - Simple Search Engines
*
* Group: TwoBrothers
*
* Partners: Kurt Banwell-Pachernegg (Z5022859)
* Sam Eager (Z3414861)
*/
#include <stdlib.h>
#include "PriorityQueue.h"
#include "BST.h"
PriorityQueue newPriorityQueue(int (*compare)(void * a, void * b))
{
PriorityQueue queue = newBST(compare);
return queue;
}
int addPriorityQueue(PriorityQueue queue, void * value)
{
return addBST(queue, value);
}
void * nextPriorityQueue(PriorityQueue queue)
{
return removeBST(queue, maxBST(queue));
}
void * peakPriorityQueue(PriorityQueue queue)
{
return maxBST(queue);
}
int existsPriorityQueue(PriorityQueue queue, void * value)
{
return existsBST(queue, value);
}
int emptyPriorityQueue(PriorityQueue queue)
{
return emptyBST(queue);
}
int sizePriorityQueue(PriorityQueue queue)
{
return sizeBST(queue);
}
void freePriorityQueue(PriorityQueue queue)
{
freeBST(queue);
}