-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtree.h
52 lines (43 loc) · 1.13 KB
/
tree.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
#ifndef _TREE_H_
#define _TREE_H_
#include <string>
//Defunc
/*struct
node{
bool op_and = false;
bool op_xor = false;
bool op_or = false;
bool op_not = false;
std::string value = "";
struct node *left = NULL;
struct node *right = NULL;
};*/
class treeNode{
public:
//Fields
std::string formula;
treeNode *left = NULL;
treeNode *right = NULL;
std::string value;
bool op_and = false;
bool op_xor = false;
bool op_or = false;
bool op_not = false;
//methods
treeNode();
treeNode(std::string formula);
~treeNode();
int main();
void printTree();
bool checkUniformity();
private:
void setCurrentNodeValue(std::string value);
void setLeftAndRight(std::vector<std::string> values);
bool getValue(std::string combination);
void createNode(std::string n);
int getInputs();
bool uniformp(std::vector<std::string> v);
bool checkForOne(std::string s);
bool checkOccurances(std::vector<int> results);
};
#endif