int main() { struct TreeNode* root = CreateTree(5); struct TreeNode* tmp1 = CreateTree(7); struct TreeNode* tmp2 = CreateTree(2); struct TreeNode* tmp3 = CreateTree(11); AddTreeLeaf(tmp3, tmp1, tmp2); tmp1 = CreateTree(4); AddTreeLeaf(tmp1, tmp3, NULL); tmp2 = CreateTree(1); tmp3 = CreateTree(4); AddTreeLeaf(tmp3, NULL, tmp2); tmp2 = CreateTree(13); struct TreeNode* tmp4 = CreateTree(8); AddTreeLeaf(tmp4, tmp2, tmp3); AddTreeLeaf(root, tmp1, tmp4); printf_s("The result is: %d\n", minDepth(root)); return 0; }
int main() { struct TreeNode* root = CreateTree(1); struct TreeNode* node1 = CreateTree(2); struct TreeNode* node2 = CreateTree(2); struct TreeNode* node3 = CreateTree(3); struct TreeNode* node4 = CreateTree(3); struct TreeNode* node5 = CreateTree(4); struct TreeNode* node6 = CreateTree(4); AddTreeLeaf(root, node1, node2); AddTreeLeaf(node1, node3, node5); AddTreeLeaf(node2, node6, node4); printf_s("The result is: %s\n", isSameTree(root, root) ? "TRUE" : "FLASE"); struct TreeNode* root1 = CreateTree(1); node1 = CreateTree(2); node2 = CreateTree(2); node3 = CreateTree(3); node4 = CreateTree(3); AddTreeLeaf(root1, node1, node3); AddTreeLeaf(node1, node4, NULL); AddTreeLeaf(node3, node2, NULL); printf_s("The result is: %s\n", isSameTree(root, root1) ? "TRUE" : "FLASE"); return 0; }