-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBST_of_Words.h
More file actions
41 lines (41 loc) · 1.02 KB
/
BST_of_Words.h
File metadata and controls
41 lines (41 loc) · 1.02 KB
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
#pragma once
#include<string>
#include"LineList.h"
#include"Word.h"
#include<fstream>
#include"tokenstuff.h"
#include<stdlib.h>
#include<vector>
#include<set>
#include"Line.h"
#include"S_Expression_Tree.h"
#include<vector>
using namespace std;
class TreeNode
{
TreeNode* pLeft;
TreeNode* pRight;
Word* pData;
friend struct BST_of_Words;
};
struct BST_of_Words
{
BST_of_Words();
~BST_of_Words();
TreeNode** findInsertionPoint(TreeNode** ppRoot, string wordToAdd);
void addWord(Word& WordToAdd);
void addFile(string fileName);
void clear(TreeNode* pRootOfCurrentTree);
LineList lines;
string print();
string print(TreeNode* pRootOfCurrentTree, string& result);
set<Word*> myFind(string thingToFind);
set<Line*> lineFind(string thingToFind);
TreeNode* pRoot;
set<Line*> query(string queryLine);
set<Line*> evaluate(sTreeNode* expression);
private:
TreeNode** myFind(TreeNode** ppRoot,string wordToFind,set<Word*>* wordSet);
TreeNode** lineFind(TreeNode** ppRoot,string wordToFind,set<Line*>* lineSet);
S_Expression_Tree sTree;
};