372 {
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
381
-
382
-
383 root->data = -1;
-
384 root->left->data = -2;
-
385 root->right->data = -3;
-
386 root->left->left->data = -4;
-
387 root->left->right->data = -5;
-
388
-
-
390 test4(binaryTree, root);
-
-
392
-
393 test5(binaryTree, root);
-
-
395
-
396 test6(binaryTree, root);
-
-
398
-
399 return 0;
-
400}
+
+
383 binaryTree;
+
384
+
+
+
+
+
+
390
+
+
392 test1(binaryTree, root);
+
+
394
+
395 test2(binaryTree, root);
+
+
397
+
398 test3(binaryTree, root);
+
+
400
+
401
+
402 root->data = -1;
+
403 root->left->data = -2;
+
404 root->right->data = -3;
+
405 root->left->left->data = -4;
+
406 root->left->right->data = -5;
+
407
+
+
409 test4(binaryTree, root);
+
+
411
+
412 test5(binaryTree, root);
+
+
414
+
415 test6(binaryTree, root);
+
+
417
+
418 deleteAll(root);
+
419
+
420 return 0;
+
421}
defines the functions associated with the binary tree
Definition iterative_tree_traversals.cpp:67
Node * createNewNode(int64_t)
function that will create new node for insertion.
Definition iterative_tree_traversals.cpp:88
@@ -253,9 +300,9 @@ Iterative Inorder Traversal of a tree
static void test1()
Self-test implementations, 1st test.
Definition dsu_path_compression.cpp:169
static void test3()
Definition hamiltons_cycle.cpp:122
-
static void test4(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root)
Test the computed preorder with the actual preorder on negative value.
Definition iterative_tree_traversals.cpp:272
-
static void test5(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root)
Test the computed postorder with the actual postorder on negative value.
Definition iterative_tree_traversals.cpp:300
-
static void test6(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root)
Test the computed inorder with the actual inorder on negative value.
Definition iterative_tree_traversals.cpp:327
+
static void test4(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root)
Test the computed preorder with the actual preorder on negative value.
Definition iterative_tree_traversals.cpp:291
+
static void test5(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root)
Test the computed postorder with the actual postorder on negative value.
Definition iterative_tree_traversals.cpp:319
+
static void test6(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root)
Test the computed inorder with the actual inorder on negative value.
Definition iterative_tree_traversals.cpp:346
defines the structure of a node of the tree
Definition iterative_tree_traversals.cpp:58