-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHeap.h
More file actions
42 lines (33 loc) · 999 Bytes
/
Heap.h
File metadata and controls
42 lines (33 loc) · 999 Bytes
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
/*
* Title: Heaps, Priority Queues
* Author: Berk Temel
* ID: 22002675
* Section: 2
* Assignment: 3
* Description: Header of Heap class, from lecture slides
*/
#ifndef HW3_HEAP_H
#define HW3_HEAP_H
#include "KeyedItem.h"
#include <string>
#include <iostream>
using namespace std;
const int MAX_HEAP = 10000;
class Heap {
public:
Heap(); // default constructor
// copy constructor and destructor are supplied by the compiler
bool heapIsEmpty() const;
void heapInsert(const KeyedItem& newItem);
void heapDelete(KeyedItem& rootItem);
bool heapFull() const;
void heapPeek(KeyedItem& topItem);
void heapChange(int time);
protected:
void heapRebuild(int root); // Converts the semiheap rooted at
// index root into a heap
private:
KeyedItem items[MAX_HEAP]; // array of heap items
int size; // number of heap items
};
#endif //HW3_HEAP_H