Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int TREEisomorph(struct node *t1, struct node *t2){
- int i=1;
- if(t1==NULL || t2==NULL){
- if((t1==NULL && t2!=NULL)||(t1!=NULL && t2==NULL)) {
- return 0; // i due alberi non sono isomorfi
- }
- else if(t1==NULL && t2==NULL)
- return 1;
- }
- if(t1->val==t2->val){
- i=TREEisomorph(t1->left,t2->left);
- if(i==1){
- return(TREEisomorph(t1->right,t2->right));
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement