Advertisement
jonator

no se nada ya

Dec 7th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.77 KB | None | 0 0
  1. void Esquema::i_buscarAreaTematica1 (Arbre<string> &a, Revista& r, list<string>& l, string& n, int& altura) {
  2.     if (not a.es_buit()) {
  3.       string arrel = a.arrel();
  4.       Arbre<string> a1, a2;
  5.       a.fills(a1,a2);
  6.       if (a1.es_buit() and a2.es_buit()) {
  7.     if (r.esPC(arrel)) {
  8.       insertarLista(l, arrel);
  9.       altura = 1;
  10.       n = arrel;
  11.     }
  12.       }
  13.       else {
  14.     list<string> l1, l2;
  15.     string n1, n2;
  16.     int alt1 = 0, alt2 = 0;
  17.     i_buscarAreaTematica1 (a1, r, l1, n1, alt1);
  18.     i_buscarAreaTematica1 (a2, r, l2, n2, alt2);
  19.     if (l1.size() == r.longitudPalabrasClave() and l2.size() == r.longitudPalabrasClave()) {
  20.       //las dos listas tienen todas las palabras clave
  21.       if (alt1 == alt2) {
  22.         //si alturas iguales elegir el de menor orden alfabetico
  23.         if (n1 < n2) {
  24.           n = n1;
  25.         }
  26.         else {
  27.           n = n2;
  28.         }
  29.         altura = alt1+1;
  30.         l = l1;
  31.       }
  32.       //sino elegir la mas precisa
  33.       else if (alt1 > alt2) {
  34.         n = n1;
  35.         l = l1;
  36.         altura = alt1;
  37.       }
  38.       else {
  39.         n = n2;
  40.         l = l2;
  41.         altura = alt2;
  42.       }
  43.     }
  44.     else if (l1.size() == r.longitudPalabrasClave() or l2.size() == r.longitudPalabrasClave()) {
  45.       //una de las dos listas tiene todas las palabras clave
  46.       if (l1.size() == r.longitudPalabrasClave()) {
  47.         //l1 las tiene todas
  48.         if (r.esPC(n1) {
  49.           //si n1 pc => pc.size() = 1 => at1 = pc = n1;
  50.           n = n1;
  51.           l = l1;
  52.           altura = alt1+1;
  53.         }
  54.         else {
  55.           //si n1 ¬pc => pc.size() > 1 => ?
  56.          
  57.         }
  58.        
  59.       }
  60.       else {
  61.         //sino l2 las tiene todas
  62.       }
  63.     }
  64.     else {
  65.       fusionarListas(l1,l2);
  66.       if (l1.size() == r.longitudPalabrasClave()) {
  67.         n = arrel;
  68.         l = l1;
  69.       }
  70.       if (alt1 > alt2)
  71.         altura = alt1;
  72.       else
  73.         altura = alt2;
  74.     }
  75.       }
  76.     }
  77.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement