?? 2 tree identical.txt
字號:
Write C code to determine if two trees are identical
Discuss it!
struct Bintree{
int element;
struct Bintree *left;
struct Bintree *right;
};
typedef struct Bintree* Tree;
int CheckIdentical( Tree T1, Tree T2 )
{
if(!T1 && !T2) // If both tree are NULL then return true
return 1;
else if((!T1 && T2) || (T1 && !T2)) //If either of one is NULL, return false
return 0;
else
return ((T1->element == T2->element) && CheckIdentical(T1->left, T2->left) && CheckIdentical(T1->right, T2->right));
// if element of both tree are same and left and right tree is also same then both trees are same
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -