Write a function that checks whether tow binary trees are isomorphic.
Two binary trees rare isomorphic if they have the same structure. The values of the nodes does not affect whether two trees are isomorphic or not.
Difficulty level
This exercise is mostly suitable for students
int isomorphic(Btree B, Btree C)
{
if(!B && !C) return 1;
if(!B && C || B && !C) return 0;
return isomorphic(B->left, C->left) && isomorphic(B->right, C->right);
}
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Search into a table based on hash coalesced with separated zones