-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBST.h
71 lines (58 loc) · 1.22 KB
/
BST.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef BST_H
#define BST_H
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
//Queue class for actors
class Q {
public:
Q();
//~Q();
void enQ(string name);
int deQ(string& name);
//int deQEnd(int& time, string& name, int& items);
int length();
string name();
void print();
private:
struct node
{
string name;
node* next;
node* prev;
};
typedef node* nodePtr;
node* head;
node* tail;
int total;
};
//Tree class for DB
class BST {
public:
BST(); //Constructor
~BST(); //Destructor
void addToBST(string title, int year, Q& actors);
void printAll();
void printTitles();
void printActors(string title);
void printMoviesOfActor(string name);
void printMoviesOfYear(int year);
private:
struct treenode {
string title;
int year;
Q actors;
treenode* left;
treenode* right;
};
treenode* root;
void lumberjack(treenode* root);//Recursively delete the tree.
void printInOrder(treenode* t);
void Titles(treenode* t);
void printActorsR(treenode* t, string title);
void printMoviesOfActorR(treenode* t, string name);
void printMoviesOfYearR(treenode* t, int year);
};
#endif // !BST_H