Record Case Detail

Notes

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

Stderr

free(): double free detected in tcache 2

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 -6, which should be 0.

Please double check your code to solve this problem and try again.

Your Answer

Entering BinaryTree
val = 5
Entering BinaryTree
val = 15
Entering BinaryTree
val = 10
Entering BinaryTree
val = 10
left.root = 0x55fc01694220
right.root = 0x55fc01694240
Entering BinaryTree
Entering copy
Entering copy
Entering copy
root is nullptr
Entering copy
root is nullptr
newNode->val = 5
Entering copy
Entering copy
root is nullptr
Entering copy
root is nullptr
newNode->val = 15
newNode->val = 10
other.root = 0x55fc01694260
Test 6: The sum of the copied tree is Entering sum
Entering sumHelper
Entering sumHelper
Entering sumHelper
Entering sumHelper
leftSum = 0
rightSum = 0
Entering sumHelper
Entering sumHelper
Entering sumHelper
leftSum = 0
rightSum = 0
leftSum = 5
rightSum = 15
30
Entering ~BinaryTree
Entering removeAll
Entering removeAll
Entering removeAll
root is nullptr
Entering removeAll
root is nullptr
Entering removeAll
Entering removeAll
root is nullptr
Entering removeAll
root is nullptr
Entering ~BinaryTree
Entering removeAll
Entering removeAll
Entering removeAll
root is nullptr
Entering removeA

JOJ Answer

Test 6: The sum of the copied tree is 30