Write a function that checks whether two binary trees are structurally identical.
Difficulty level
This exercise is mostly suitable for students
int identical(Btree B, Btree C)
{
if(!B && !C) return 1;
if(!B || !C) return 0;
return B->data==C->data && identical(B->left,C->left) && identical(B->right,C->right);
}
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Articulation points cut bridges and cut edges