Notes
This function is in beta test. Please help improve it in the issues
here.
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 -11, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
Entering BinaryTree val = 8 Entering BinaryTree val = 2 Entering BinaryTree val = 5 Entering BinaryTree val = 5 left.root = 0x56504b322240 right.root = 0x56504b322220 Entering ~BinaryTree Entering removeAll Entering removeAll root is nullptr Entering removeAll root is nullptr Entering ~BinaryTree Entering removeAll Entering removeAll root is nullptr Entering removeAll root is nullptr Entering BinaryTree val = 18 Entering BinaryTree val = 12 Entering BinaryTree val = 15 Entering BinaryTree val = 15 left.root = 0x56504b322240 right.root = 0x56504b322220 Entering ~BinaryTree Entering removeAll Entering removeAll root is nullptr Entering removeAll root is nullptr Entering ~BinaryTree Entering removeAll Entering removeAll root is nullptr Entering removeAll root is nullptr Entering BinaryTree val = 10 Entering BinaryTree val = 10 left.root = 0x56504b322260 right.root = 0x56504b322280 Test 3: The depth of the tree is Entering depth Entering depthHelper Entering depthHelper Entering depthHelper Entering depthHelper E
JOJ Answer
Test 3: The depth of the tree is 3