Record Case Detail

Notes

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

Stderr

=================================================================
==112326==ERROR: AddressSanitizer: heap-use-after-free on address 0x603000001518 at pc 0x5653b5598a62 bp 0x7ffeab8e56d0 sp 0x7ffeab8e56c0
READ of size 8 at 0x603000001518 thread T0
    #0 0x5653b5598a61 in BinaryTree::removeAll(TreeNode*) /in/ex6.cpp:112
    #1 0x5653b5598a78 in BinaryTree::removeAll(TreeNode*) /in/ex6.cpp:112
    #2 0x5653b559758e in BinaryTree::~BinaryTree() /in/ex6.cpp:25
    #3 0x5653b559818d in BinaryTree::depth() const /in/ex6.cpp:72
    #4 0x5653b55a2af2 in test18() /in/compile/TestFunctions.cpp:265
    #5 0x5653b55aab0c in std::_Function_handler<void (), void (*)()>::_M_invoke(std::_Any_data const&) /usr/include/c++/7/bits/std_function.h:316
    #6 0x5653b55aa7e6 in std::function<void ()>::operator()() const /usr/include/c++/7/bits/std_function.h:706
    #7 0x5653b55996b5 in runTests(int) /in/compile/TestFunctions.cpp:20
    #8 0x5653b5596e70 in main /in/compile/test.cpp:13
    #9 0x7f708ddb4c86 in __libc_start_main (/l

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 18: Medium Random Tree

JOJ Answer

Test 18: Medium Random Tree
Depth: 8
Sum: 1433
In-order Traversal: 41 67 39 33 41 53 71 55 98 89 60 24 36 32 50 1 25 34 87 48 96 61 52 69 34 67 34 36