Record Case Detail

Notes

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

Stderr

=================================================================
==53842==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new vs operator delete []) on 0x603000000040
    #0 0x7fefb5575480 in operator delete[](void*) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe1480)
    #1 0x56126a085171 in BinaryTree::~BinaryTree() /in/ex6.cpp:87
    #2 0x56126a085a53 in buildBalancedTree(int) /in/compile/TestFunctions.cpp:37
    #3 0x56126a0859d1 in buildBalancedTree(int) /in/compile/TestFunctions.cpp:36
    #4 0x56126a0859d1 in buildBalancedTree(int) /in/compile/TestFunctions.cpp:36
    #5 0x56126a0859d1 in buildBalancedTree(int) /in/compile/TestFunctions.cpp:36
    #6 0x56126a08aa25 in test11() /in/compile/TestFunctions.cpp:177
    #7 0x56126a096c0e in std::_Function_handler<void (), void (*)()>::_M_invoke(std::_Any_data const&) /usr/include/c++/7/bits/std_function.h:316
    #8 0x56126a0968e8 in std::function<void ()>::operator()() const /usr/include/c++/7/bits/std_function.h:706
    #9 0x56126a085877 in runTest

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


        

JOJ Answer

Test 11: Deep Copy Check for Balanced Tree
Original Sum: 57, Copy Sum: 57
Original Depth: 5, Copy Depth: 5
Modifying Copy (Adding Tree)...
Original Sum after Copy Modified: 57