-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
39 lines (35 loc) · 951 Bytes
/
main.cpp
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
#include <iostream>
#include "function.h"
using namespace std;
int main()
{
Implement inst = *(new Implement());
string command;
Node *root;
string treeStr = "";
while(cin>>treeStr){
root = NULL;
root = inst.constructTree(treeStr);
inst.Inorder_traversal(root);
cout<<endl;
inst.Preorder_traversal(root);
cout<<endl;
inst.Postorder_traversal(root);
cout<<endl;
inst.Levelorder_traversal(root);
cout<<endl;
cout<<inst.TreeHeight(root)<<endl;
cout<<inst.TreeWeightSum(root)<<endl;
cout<<inst.MaximumPathSum(root)<<endl;
inst.Invert(root);
inst.Inorder_traversal(root);
cout<<endl;
inst.Preorder_traversal(root);
cout<<endl;
inst.Postorder_traversal(root);
cout<<endl;
inst.Levelorder_traversal(root);
root = inst.deleteTree(root);
}
return 0;
}