blob: 25b7a9abf72ed977011632961a0528f3fa8e0373 (
plain)
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
|
#pragma once
using namespace std;
#include "stdafx.h"
#include "Node.h"
#include "System.h"
#include "BasicTypeContainers.h"
class BinaryHeap
{
private:
NodeArray heap;
int sizeVar;
// 4J Jev, add common ctor code.
void _init();
public:
BinaryHeap();
~BinaryHeap();
Node *insert(Node *node);
void clear();
Node *peek();
Node *pop();
void remove(Node *node);
void changeCost(Node *node, float newCost);
int size();
private:
void upHeap(int idx);
void downHeap(int idx);
public:
bool isEmpty();
};
|