-
Notifications
You must be signed in to change notification settings - Fork 0
/
BinaryTree.h
50 lines (41 loc) · 907 Bytes
/
BinaryTree.h
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
43
44
45
46
47
48
49
50
//
// BinaryTree.h
// Homework 8
//
// Created by Stephan on 12/10/14.
// Copyright (c) 2014 cst 238. All rights reserved.
//
#ifndef Homework_8_BinaryTree_h
#define Homework_8_BinaryTree_h
template <typename T>
class BTNode {
private:
T data;
BTNode *left;
BTNode *right;
public:
BTNode() { }
BTNode(T d, BTNode* l = NULL, BTNode *r = NULL) {
data = d;
left = l;
right = r;
}
const T getData() const { return data; }
const BTNode *leftChild() const { return left; }
const BTNode *rightChild() const { return right; }
};
template <typename T>
class BinaryTree {
private:
BTNode<T> *root;
public:
BinaryTree() { root = NULL; }
BinaryTree(BTNode<T> *r) { root = r; }
bool isMinHeap() const;
};
template <typename T>
bool BinaryTree<T>::isMinHeap() const {
// Your code here
return true;
}
#endif