Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==121964==ERROR: AddressSanitizer: heap-use-after-free on address 0x603000098d48 at pc 0x55ea80d8fa62 bp 0x7ffdb33ce890 sp 0x7ffdb33ce880 READ of size 8 at 0x603000098d48 thread T0 #0 0x55ea80d8fa61 in BinaryTree::removeAll(TreeNode*) /in/ex6.cpp:112 #1 0x55ea80d8fa78 in BinaryTree::removeAll(TreeNode*) /in/ex6.cpp:112 #2 0x55ea80d8e58e in BinaryTree::~BinaryTree() /in/ex6.cpp:25 #3 0x55ea80d8ebb0 in BinaryTree::sum() const /in/ex6.cpp:55 #4 0x55ea80d8ea2a in BinaryTree::sum() const /in/ex6.cpp:51 #5 0x55ea80d8ea2a in BinaryTree::sum() const /in/ex6.cpp:51 #6 0x55ea80d8ea2a in BinaryTree::sum() const /in/ex6.cpp:51 #7 0x55ea80d9d9be in test25() /in/compile/TestFunctions.cpp:346 #8 0x55ea80da1b0c in std::_Function_handler<void (), void (*)()>::_M_invoke(std::_Any_data const&) /usr/include/c++/7/bits/std_function.h:316 #9 0x55ea80da17e6 in std::function<void ()>::operator()() const /usr/include/c++/7/bits/s
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 25: Extremely Large Random Tree Empty? No
JOJ Answer
Test 25: Extremely Large Random Tree Empty? No Sum: 57147 Depth: 21 In-order Traversal: 47 0 78 49 79 30 54 87 77 4 59 41 91 64 8 41 40 92 25 69 47 84 82 97 93 71 83 23 94 5 68 49 95 19 94 68 50 15 26 95 95 22 68 85 98 62 22 12 24 41 90 3 19 46 81 33 83 12 62 9 24 71 10 52 0 54 80 68 4 40 25 97 17 39 17 66 26 31 77 60 26 64 83 0 62 52 76 98 34 34 75 11 81 89 66 66 49 40 55 66 84 93 23 44 50 88 15 89 71 85 66 47 21 55 10 21 84 97 34 39 19 51 1 54 8 82 43 12 94 76 51 97 86 86 82 78 24 58 36 15 20 86 58 13 83 46 80 9 38 84 51 97 54 85 69 85 16 75 0 97 59 28 62 92 13 20 24 52 92 48 40 13 52 18 88 7 4 89 58 32 88 76 32 97 80 92 52 6 92 97 64 83 81 30 44 76 23 57 59 8 14 79 69 68 75 54 53 9 29 53 14 68 86 66 79 80 98 77 97 37 54 61 2 9 36 38 25 6 29 3 99 12 65 35 85 55 98 93 37 42 79 74 46 44 72 50 49 98 92 50 25 69 80 79 30 58 81 10 66 18 48 70 78 65 61 14 21 97 15 17 38 56 16 19 99 23 7 34 33 53 44 21 55 97 20 27 53 14 80 57 17 16 33 96 41 23 50 13 12 39 34 5 46 14 93 90 64 65 86 7 15 85 57 14 20 44 41 67 23 34 4