Record Case Detail

Notes

This function is in beta test. Please help improve it in the issues here.

Stderr

=================================================================
==121958==ERROR: AddressSanitizer: heap-use-after-free on address 0x6030000002e8 at pc 0x5593b55fea62 bp 0x7ffca4c22ed0 sp 0x7ffca4c22ec0
READ of size 8 at 0x6030000002e8 thread T0
    #0 0x5593b55fea61 in BinaryTree::removeAll(TreeNode*) /in/ex6.cpp:112
    #1 0x5593b55feafe in BinaryTree::removeAll(TreeNode*) /in/ex6.cpp:113
    #2 0x5593b55fd58e in BinaryTree::~BinaryTree() /in/ex6.cpp:25
    #3 0x5593b55fdbb0 in BinaryTree::sum() const /in/ex6.cpp:55
    #4 0x5593b55fdb9e in BinaryTree::sum() const /in/ex6.cpp:56
    #5 0x5593b55fdb9e in BinaryTree::sum() const /in/ex6.cpp:56
    #6 0x5593b55fdb9e in BinaryTree::sum() const /in/ex6.cpp:56
    #7 0x5593b5606353 in test13() /in/compile/TestFunctions.cpp:214
    #8 0x5593b5610b0c in std::_Function_handler<void (), void (*)()>::_M_invoke(std::_Any_data const&) /usr/include/c++/7/bits/std_function.h:316
    #9 0x5593b56107e6 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 13: Right Heavy Linear Tree
Empty? No

JOJ Answer

Test 13: Right Heavy Linear Tree
Empty? No
Sum: 21
Depth: 6
In-order Traversal: 6 5 4 3 2 1