Record Case Detail

Notes

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

Stderr

=================================================================
==119116==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7fe40c5c7448 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0448)
    #1 0x560661b15637 in BinaryTree::copy(TreeNode*) /in/ex6.cpp:109
    #2 0x560661b1585c in BinaryTree::copy(TreeNode*) /in/ex6.cpp:113
    #3 0x560661b14505 in BinaryTree::BinaryTree(int, BinaryTree const&, BinaryTree const&) /in/ex6.cpp:19
    #4 0x560661b1675c in operator() /in/compile/TestFunctions.cpp:66
    #5 0x560661b2591e in _M_invoke /usr/include/c++/7/bits/std_function.h:302
    #6 0x560661b27482 in std::function<BinaryTree (int)>::operator()(int) const /usr/include/c++/7/bits/std_function.h:706
    #7 0x560661b1673f in operator() /in/compile/TestFunctions.cpp:64
    #8 0x560661b2591e in _M_invoke /usr/include/c++/7/bits/std_function.h:302
    #9 0x560661b27482 in std::function<BinaryTree (int)>::operator()(int) const /u

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 20: Very Large Random Tree
Depth: 7
Sum: 5561
In-order Traversal: 0 99 0 95 0 40 0 25 0 41 0 91 0 65 0 24 0 52 0 53 0 79 0 61 0 55 0 60 0 52 0 55 0 46 0 71 0 77 0 48 0 5 0 72 0 79 0 91 0 83 0 43 0 53 0 94 0 96 0 36 0 1 0 2 0 89 0 2 0 77 0 12 0 66 0 67 0 92 0 31 0 57 0 15 0 69 0 12 0 67 0 75 0 63 0 87 0 71 0 3 0 78 0 26 0 97 0 97 0 18 0 4 0 18 0 25 0 69 0 76 0 88 0 86 0 39 0 76 0 60 0 92 0 31 0 22 0 75 0 23 0 64 0 3 0 43 0 59 0 8 0 57 0 26 0 54 0 92 0 31 0 22 0 11 0 87 0 44 0 13 0 72 0 62 0 39 0 33 0 32 0 19 0 51 0 27 0 99 0 35 0 91 0 43 0 47 0 40 0 44 0 32 0 82 0 62 0 6 0 4 0 3 0 92 0 1 0 32 0 

JOJ Answer

Test 20: Very Large Random Tree
Depth: 12
Sum: 5561
In-order Traversal: 99 95 40 25 41 91 65 24 52 53 79 61 55 60 52 55 46 71 77 48 5 72 79 91 83 43 53 94 96 36 1 2 89 2 77 12 66 67 92 31 57 15 69 12 67 75 63 87 71 3 78 26 97 97 18 4 18 25 69 76 88 86 39 76 60 92 31 22 75 23 64 3 43 59 8 57 26 54 92 31 22 11 87 44 13 72 62 39 33 32 19 51 27 99 35 91 43 47 40 44 32 82 62 6 4 3 92 1 32