priorityqueue.h 989 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // include guard
  2. #ifndef PRIORITYQ_H
  3. #define PRIORITYQ_H
  4. #include "json.hpp"
  5. class PriorityQueue{
  6. int *heapArray; // pointer to heap array
  7. int max_size; // max size of heap array
  8. int heap_size; // elements in heap
  9. public:
  10. // required functions
  11. void insert(int);
  12. void removeMax();
  13. void removeKey(int);
  14. void change(int, int);
  15. // helpful functions
  16. void heapifyUp(int, int);
  17. void heapifyDown(int);
  18. void printJSONTree(int, int);
  19. // other required functions (for now)
  20. void initiateHeap(int);
  21. void printArray();
  22. void deleteHeap();
  23. int returnMax();
  24. void swap(int*, int*);
  25. };
  26. void insert(int key);
  27. void removeMax();
  28. void removeKey(int key);
  29. void change(int key, int newKey);
  30. // helpful functions
  31. void heapifyUp(int key, int index);
  32. void heapifyDown(int index);
  33. void printJSONTree(int, int);
  34. // other required functions (for now)
  35. void initiateHeap(int capacity);
  36. void printArray();
  37. int returnMax();
  38. void deleteHeap();
  39. void swap(int*, int*);
  40. #endif