-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
25 lines (20 loc) · 734 Bytes
/
Copy pathtest.cpp
File metadata and controls
25 lines (20 loc) · 734 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
#include "balanced_binary_tree.hpp"
static void runTest(TreeNode* root) {
Solution sol;
cout << (sol.isBalanced(root) ? "true" : "false") << endl;
}
int main() {
std::cout << ">>>>>>>>>> example 1 <<<<<<<<<<" << std::endl;
vector<optional<int>> test1 = {3, 9, 20, nullopt, nullopt, 15, 7};
TreeNode *tree = creatBinaryTree(test1);
runTest(tree);
freeBinaryTree(tree);
std::cout << ">>>>>>>>>> example 2 <<<<<<<<<<" << std::endl;
vector<optional<int>> test2 = {1, 2, 2, 3, 3, nullopt, nullopt, 4, 4};
tree = creatBinaryTree(test2);
runTest(tree);
freeBinaryTree(tree);
std::cout << ">>>>>>>>>> example 3 <<<<<<<<<<" << std::endl;
runTest(nullptr);
return 0;
}