Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==121514==ERROR: LeakSanitizer: detected memory leaks Direct leak of 6624 byte(s) in 276 object(s) allocated from: #0 0x7fb76766b448 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0448) #1 0x55e0fcb6b637 in BinaryTree::copy(TreeNode*) /in/ex6.cpp:109 #2 0x55e0fcb6b85c in BinaryTree::copy(TreeNode*) /in/ex6.cpp:113 #3 0x55e0fcb6b781 in BinaryTree::copy(TreeNode*) /in/ex6.cpp:112 #4 0x55e0fcb6b85c in BinaryTree::copy(TreeNode*) /in/ex6.cpp:113 #5 0x55e0fcb6b85c in BinaryTree::copy(TreeNode*) /in/ex6.cpp:113 #6 0x55e0fcb6b85c in BinaryTree::copy(TreeNode*) /in/ex6.cpp:113 #7 0x55e0fcb6b85c in BinaryTree::copy(TreeNode*) /in/ex6.cpp:113 #8 0x55e0fcb6b85c in BinaryTree::copy(TreeNode*) /in/ex6.cpp:113 #9 0x55e0fcb6b85c in BinaryTree::copy(TreeNode*) /in/ex6.cpp:113 #10 0x55e0fcb6b85c in BinaryTree::copy(TreeNode*) /in/ex6.cpp:113 #11 0x55e0fcb6b85c in BinaryTree::copy(TreeN
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
Test 22: Right Heavy Linear Tree (Large) Empty? No Sum: 1275 Depth: 51 In-order Traversal: 0 50 0 49 0 48 0 47 0 46 0 45 0 44 0 43 0 42 0 41 0 40 0 39 0 38 0 37 0 36 0 35 0 34 0 33 0 32 0 31 0 30 0 29 0 28 0 27 0 26 0 25 0 24 0 23 0 22 0 21 0 20 0 19 0 18 0 17 0 16 0 15 0 14 0 13 0 12 0 11 0 10 0 9 0 8 0 7 0 6 0 5 0 4 0 3 0 2 0 1 0
JOJ Answer
Test 22: Right Heavy Linear Tree (Large) Empty? No Sum: 1275 Depth: 50 In-order Traversal: 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1