-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
62 lines (50 loc) · 1.38 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <iostream>
#include "BinaryTree.hpp"
#include "BinaryTree.cpp"
/*
Arvore inserida
13
/ \
10 25
/ \ / \
2 12 20 31
/
29
*/
int main() {
BinarySearchTree<int> bst;
bst.insert(13);
bst.insert(10);
bst.insert(25);
bst.insert(2);
bst.insert(12);
bst.insert(20);
bst.insert(31);
bst.insert(29);
/*
std::cout << "Impressao da arvore em pre-ordem:" << std::endl;
bst.printInPreOrder();
std::cout << "Impressao da arvore em ordem:" << std::endl;
bst.printInOrder();
bst.remove(25);
std::cout << "Impressao da arvore em ordem:" << std::endl;
bst.printInOrder();
std::cout << "Impressao da arvore em pos-ordem:" << std::endl;
bst.printInPostOrder();
std::cout << "Procurando nos..." << std::endl;
if(bst.search(31)) {
std::cout << "O valor 31 esta na arvore" << std::endl;
} else {
std::cout << "O valor 31 nao esta na arvore" << std::endl;
}
if(bst.search(99)) {
std::cout << "O valor 99 esta na arvore" << std::endl;
} else {
std::cout << "O valor 99 nao esta na arvore" << std::endl;
}
std::cout << "Minimo: " << bst.findMin() << std::endl;
std::cout << "Maximo: " << bst.findMax() << std::endl;
*/
std::cout << bst.toString() << std::endl;
return 0;
}