90 std::vector<std::uint64_t>
92 std::vector<std::uint64_t>
94 std::vector<std::uint64_t>
101 std::vector<std::uint64_t> inorder(
104 std::vector<std::uint64_t>
preorder(
213 std::vector<std::uint64_t> actual_result_inorder{2, 7, 5, 6, 11,
215 std::vector<std::uint64_t> actual_result_preorder{2, 7, 2, 6, 5,
217 std::vector<std::uint64_t> actual_result_postorder{2, 5, 11, 6, 7,
219 std::vector<std::uint64_t>
222 std::vector<std::uint64_t>
225 std::vector<std::uint64_t>
229 std::uint64_t size = actual_result_inorder.size();
233 result_inorder = obj1.inorder(root);
234 std::cout <<
"Testcase #1: Inorder Traversal...";
235 for (
auto i = 0; i < size; ++i) {
236 assert(actual_result_inorder[i] == result_inorder[i]);
238 std::cout <<
"Passed!" << std::endl;
242 result_preorder = obj1.
preorder(root);
243 std::cout <<
"Testcase #1: Preorder Traversal...";
244 for (
auto i = 0; i < size; ++i) {
245 assert(actual_result_preorder[i] == result_preorder[i]);
247 std::cout <<
"Passed!" << std::endl;
252 std::cout <<
"Testcase #1: Postorder Traversal...";
253 for (
auto i = 0; i < size; ++i) {
254 assert(actual_result_postorder[i] == result_postorder[i]);
256 std::cout <<
"Passed!" << std::endl;
258 std::cout << std::endl;
277 std::vector<std::uint64_t> actual_result_inorder{4, 2, 1, 7, 5, 8, 3, 6};
278 std::vector<std::uint64_t> actual_result_preorder{1, 2, 4, 3, 5, 7, 8, 6};
279 std::vector<std::uint64_t> actual_result_postorder{4, 2, 7, 8, 5, 6, 3, 1};
280 std::vector<std::uint64_t>
283 std::vector<std::uint64_t>
286 std::vector<std::uint64_t>
290 std::uint64_t size = actual_result_inorder.size();
294 result_inorder = obj2.inorder(root);
295 std::cout <<
"Testcase #2: Inorder Traversal...";
296 for (
auto i = 0; i < size; ++i) {
297 assert(actual_result_inorder[i] == result_inorder[i]);
299 std::cout <<
"Passed!" << std::endl;
303 result_preorder = obj2.
preorder(root);
304 std::cout <<
"Testcase #2: Preorder Traversal...";
305 for (
auto i = 0; i < size; ++i) {
306 assert(actual_result_preorder[i] == result_preorder[i]);
308 std::cout <<
"Passed!" << std::endl;
313 std::cout <<
"Testcase #2: Postorder Traversal...";
314 for (
auto i = 0; i < size; ++i) {
315 assert(actual_result_postorder[i] == result_postorder[i]);
317 std::cout <<
"Passed!" << std::endl;
319 std::cout << std::endl;
335 std::vector<std::uint64_t> actual_result_inorder{4, 2, 5, 1, 3};
336 std::vector<std::uint64_t> actual_result_preorder{1, 2, 4, 5, 3};
337 std::vector<std::uint64_t> actual_result_postorder{4, 5, 2, 3, 1};
338 std::vector<std::uint64_t>
341 std::vector<std::uint64_t>
344 std::vector<std::uint64_t>
348 std::uint64_t size = actual_result_inorder.size();
353 result_inorder = obj3.inorder(root);
354 std::cout <<
"Testcase #3: Inorder Traversal...";
355 for (
auto i = 0; i < size; ++i) {
356 assert(actual_result_inorder[i] == result_inorder[i]);
358 std::cout <<
"Passed!" << std::endl;
362 result_preorder = obj3.
preorder(root);
363 std::cout <<
"Testcase #3: Preorder Traversal...";
364 for (
auto i = 0; i < size; ++i) {
365 assert(actual_result_preorder[i] == result_preorder[i]);
367 std::cout <<
"Passed!" << std::endl;
372 std::cout <<
"Testcase #3: Postorder Traversal...";
373 for (
auto i = 0; i < size; ++i) {
374 assert(actual_result_postorder[i] == result_postorder[i]);
376 std::cout <<
"Passed!" << std::endl;
378 std::cout << std::endl;