-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
32 lines (26 loc) · 934 Bytes
/
Copy pathtest.cpp
File metadata and controls
32 lines (26 loc) · 934 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
31
32
#include "binary_tree_inorder_traversal.hpp"
static void runTest(TreeNode* root) {
Solution sol;
vector<int> res = sol.inorderTraversal(root);
printVec(res);
cout << endl;
}
int main() {
std::cout << ">>>>>>>>>> example 1 <<<<<<<<<<" << std::endl;
vector<optional<int>> test1{1, nullopt, 2, nullopt, nullopt, 3};
TreeNode *root1 = creatBinaryTree(test1);
runTest(root1);
freeBinaryTree(root1);
std::cout << ">>>>>>>>>> example 2 <<<<<<<<<<" << std::endl;
vector<optional<int>> test2{1, 2, 3, 4, 5, nullopt, 8, nullopt,
nullopt, 6, 7, nullopt, nullopt, 9};
TreeNode *root2 = creatBinaryTree(test2);
runTest(root2);
freeBinaryTree(root2);
std::cout << ">>>>>>>>>> example 3 <<<<<<<<<<" << std::endl;
runTest(nullptr);
std::cout << ">>>>>>>>>> example 4 <<<<<<<<<<" << std::endl;
TreeNode root4(1);
runTest(&root4);
return 0;
}