Huffman Zipper  v-1.0
Data Compression and Decompression using Greedy Huffman Algorithm
PriorityQueue.h
Go to the documentation of this file.
1 #pragma once
2 #include "MinHeap.h"
3 
9 template <class T>
11 private:
12 
15 public:
16 
18  void enqueue(const T&);
19 
21  T dequeue();
22 
24  T top();
25 
27  bool isEmpty();
28 
30  int getSize();
31 
33  void display();
34 };
35 
36 /************************************************************************/
37 /* implementation */
38 /************************************************************************/
39 
40 template <class T>
42  return heap.isEmpty();
43 }
44 
45 template <class T>
47  return heap.getSize();
48 }
49 
50 template <class T>
51 void PriorityQueue<T>::enqueue(const T& value) {
52  heap.insert(value);
53 }
54 
55 template <class T>
57  return heap.remove();
58 }
59 
60 template <class T>
62  return heap.min();
63 }
64 
65 template <class T>
67  std::cout << "Priority Queue : ";
68  heap.display();
69 }
This class models a structure called a MinHeap in which value in the root node is minimum.
Definition: MinHeap.h:18
This class models Priority Queue in which values are processed in order of priority.
Definition: PriorityQueue.h:10
void display()
Prints the values of the priority queue.
Definition: PriorityQueue.h:66
MinHeap< T > heap
MinHeap Data Structure for Priority Queue implementation.
Definition: PriorityQueue.h:14
T dequeue()
Removes and returns the highest priority value.
Definition: PriorityQueue.h:56
void enqueue(const T &)
Adds value to the priority queue
Definition: PriorityQueue.h:51