Advertisement
Guest User

Untitled

a guest
Feb 13th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. int subtree(link root1, link root2){
  2. int uguali;
  3. if (KEYcmp(root1->key, root2->key)==0){ //se uguali
  4. uguali = 1;
  5. if (root1->l != NULL){
  6. uguali = subtree(root1->l, root2->l); //aggiunto 1 che mancava
  7. }
  8. else
  9. return uguali;
  10. if (root1->r != NULL){ //aggiunto 1 che mancava
  11. uguali = subtree(root1->r, root2->r);
  12. }
  13. else
  14. return uguali;
  15. }
  16. else{ //se diversi
  17. uguali = 0;
  18. if(root1->l != NULL){
  19. uguali = subtree(root1->l, root2);
  20. }
  21. else
  22. return uguali;
  23. if (root1->r != NULL){
  24. uguali = subtree(root1->r, root2);
  25. }
  26. else
  27. return uguali;
  28. }
  29.  
  30. return uguali;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement