forked from rtrettin/cop4530
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bet.h
40 lines (37 loc) · 1020 Bytes
/
bet.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
/* Remi Trettin COP4530 Project 4 */
#ifndef BET_H
#define BET_H
#include <string>
#include <vector>
using std::string;
using std::vector;
class BET{
public:
BET();
BET(const string postfix);
BET(const BET&);
~BET();
bool buildFromPostfix(const string postfix);
const BET & operator=(const BET&);
void printInfixExpression();
void printPostfixExpression();
size_t size();
size_t leaf_nodes();
bool empty();
private:
struct BinaryNode {
string element;
BinaryNode *left;
BinaryNode *right;
BinaryNode(const string &e, BinaryNode *l = NULL, BinaryNode *r = NULL) : element(e), left(l), right(r) {}
};
BinaryNode *root;
void printInfixExpression(BinaryNode *n);
void printPostfixExpression(BinaryNode *n);
void makeEmpty(BinaryNode* &t);
BinaryNode * clone(BinaryNode *t) const;
size_t size(BinaryNode *t);
size_t leaf_nodes(BinaryNode *t);
vector<string> explode(string const &s, char delimiter);
};
#endif