priorityqueue.h 859 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. //nlohmann::json JSON();
  19. // other required functions (for now)
  20. void initiateHeap(int);
  21. void printArray();
  22. };
  23. void insert(int key);
  24. void removeMax();
  25. void removeKey(int key);
  26. void change(int* key, int* newKey);
  27. // helpful functions
  28. void heapifyUp(int key, int index);
  29. void heapifyDown(int index);
  30. //nlohmann::json JSON();
  31. // other required functions (for now)
  32. void initiateHeap(int capacity);
  33. void printArray();
  34. #endif