-
Notifications
You must be signed in to change notification settings - Fork 0
/
bintree.h
42 lines (34 loc) · 1.25 KB
/
bintree.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
// ----------------------------------------------- bintree.h --------------------------------------------------------
// Name: Ihar Simanovich
// Course: CSS343 A
// Creation Date: 10/17/2016
// Last Modification: 10/22/2016
// ------------------------------------------------------------------------------------------------------------------
#ifndef BINTREE_H_
#define BINTREE_H_
#include <iostream>
#include "movie.h"
using namespace std;
class BinTree {
public:
//constructors and destructor
BinTree();
~BinTree();
void printData()const; //prints all movies in the tree
bool retrieve(Movie &, Movie* &); //retrieves requested object from the tree
bool isEmpty() const; //checks if tree is empty
void makeEmpty(); //makes tree empty
bool insert(Movie*); //insert data into tree
private:
struct Node {
Movie* data;
Node* left; // left subtree pointer
Node* right; // right subtree pointer
};
Node* root = NULL; // root of the tree
void printDataHelper(Node*)const;
bool retrieveHelper(Movie&, Movie* &, Node*&);//retrieve helper function
void makeEmpty(Node*&); //makeEmpty helper function
bool insert(Movie*, Node*&); //insert helper function
};
#endif /* BINTREE_H_ */