Record Case Detail

Notes

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

Stderr

=================================================================
==121960==ERROR: AddressSanitizer: heap-use-after-free on address 0x603000000558 at pc 0x56243dff8a62 bp 0x7fffc5808fd0 sp 0x7fffc5808fc0
READ of size 8 at 0x603000000558 thread T0
    #0 0x56243dff8a61 in BinaryTree::removeAll(TreeNode*) /in/ex6.cpp:112
    #1 0x56243dff8a78 in BinaryTree::removeAll(TreeNode*) /in/ex6.cpp:112
    #2 0x56243dff758e in BinaryTree::~BinaryTree() /in/ex6.cpp:25
    #3 0x56243dff818d in BinaryTree::depth() const /in/ex6.cpp:72
    #4 0x56243dff8146 in BinaryTree::depth() const /in/ex6.cpp:73
    #5 0x56243dff8146 in BinaryTree::depth() const /in/ex6.cpp:73
    #6 0x56243dff8146 in BinaryTree::depth() const /in/ex6.cpp:73
    #7 0x56243dff8146 in BinaryTree::depth() const /in/ex6.cpp:73
    #8 0x56243dff8146 in BinaryTree::depth() const /in/ex6.cpp:73
    #9 0x56243e002376 in test17() /in/compile/TestFunctions.cpp:254
    #10 0x56243e00ab0c in std::_Function_handler<void (), void (*)()>::_M_invoke(std::_Any_data con

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 17: Left Heavy Linear Tree

JOJ Answer

Test 17: Left Heavy Linear Tree
Depth: 8
Sum: 36
In-order Traversal: 1 2 3 4 5 6 7 8