Advertisement
howarto

Recopilación: Arbres quasi coincidents X64411 ca

Apr 29th, 2015
742
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. #include <iostream>
  2. #include "Arbre.hh"
  3.  
  4. using namespace std;
  5.  
  6. bool quasi_coincidents2(Arbre<int> &a, Arbre<int> &b, bool &quasi){
  7.     bool f;
  8.     if((a.es_buit() and not b.es_buit()) or (not a.es_buit() and b.es_buit())){
  9.         if(quasi) f = false;
  10.         else if(not quasi){
  11.         if (not b.es_buit()) {
  12.             Arbre <int> auxb(b);
  13.             Arbre<int> b1;
  14.             Arbre<int> b2;
  15.             auxb.fills(b1,b2);
  16.             if (b1.es_buit() and b2.es_buit()) f = true;
  17.             else f = false;
  18.         }
  19.         else if (not a.es_buit()) {
  20.             Arbre <int> auxa(a);
  21.             Arbre<int> a1;
  22.             Arbre<int> a2;
  23.             auxa.fills(a1,a2);
  24.             if (a1.es_buit() and a2.es_buit()) f = true;
  25.             else f = false;
  26.         }
  27.         quasi = true;
  28.         }
  29.     }
  30.     else if(a.es_buit() and b.es_buit()) f = true;
  31.     else {
  32.         Arbre<int> a1;
  33.         Arbre<int> a2;
  34.         Arbre<int> b1;
  35.         Arbre<int> b2;
  36.         a.fills(a1,a2);
  37.         b.fills(b1,b2);
  38.         f=quasi_coincidents2(a1,b1, quasi);
  39.         if(f) f=quasi_coincidents2(a2,b2, quasi);
  40.     }
  41.     return f;
  42. }
  43.  
  44. bool quasi_coincidents(Arbre<int> &a, Arbre<int> &b){
  45.     bool quasi=false;
  46.     return quasi_coincidents2(a, b, quasi);
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement