Delete tree
In order to delete the tree, it is necessary to traverse all the nodes of the tree, and then delete them one by one. Considering that the pre-order traversal, the middle-order traversal, and the layer-order traversal require additional space overhead, therefore, the post-order traversal is the most suitable
void deleteBinaryTreeNode(BinaryTreeNode root){
if(root == null)
return;
deleteBinaryTreeNode(root.getLeft());
deleteBinaryTreeNode(root.getRight());
root = null;
}