-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbst.cpp
More file actions
30 lines (28 loc) · 749 Bytes
/
Copy pathbst.cpp
File metadata and controls
30 lines (28 loc) · 749 Bytes
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
// bst.cpp : 定义控制台应用程序的入口点。
//
#include<iostream>
#include"bst.h"
using namespace std;
int main() {
bst<char, const char*>* tree = new bst< char, const char*>();
tree->insert('c', "2.0");
tree->insert('b', "1.0");
tree->insert('a', "2.0");
tree->insert('f', "2.0");
tree->insert('e', "10.0");
tree->insert('h', "10.0");
tree->insert('g', "10.0");
tree->insert('i', "10.0");
tree->remove('i');
//preorder
cout << "preOrder:" << endl;
tree->print(PRE_ORDER);
cout << "-------------------------" << endl;
cout << "midOrder:" << endl;
tree->print(MID_ORDER);
cout << "-------------------------" << endl;
cout << "postOrder:" << endl;
tree->print(POST_ORDER);
cout << "-------------------------" << endl;
return 0;
}