| 123456789101112131415161718192021222324252627 |
- // include guard
- #ifndef AVLC_H
- #define AVLC_H
- #include <iostream>
- #include <cstdio>
- #include <string>
- #include "json.hpp"
- #include "BST.h"
- class AVLCommands{
- int *heapArray; // pointer to heap array
- int max_size; // max size of heap array
- int heap_size; // elements in heap
- void swap(int*, int*); // swaps two keys in the heap
- void heapifyUp(int); // moves keys up if they are larger than their parent key
- void heapifyDown(int); // moves keys down if they are smaller than their parent key
- public:
- // required functions from PDF
- void Insert(int key); // inserts a new key into AVL tree
- void Delete(int key); // deletes specified key
- void DeleteMin(); // removes the minimum value key
- // helpful functions
- void printJSONTree(int, int); // prints the heap as a JSON object
- };
- #endif
|