Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Esquema::i_buscarAreaTematica1 (Arbre<string> &a, Revista& r, list<string>& l, string& n, int& altura) {
- if (not a.es_buit()) {
- string arrel = a.arrel();
- Arbre<string> a1, a2;
- a.fills(a1,a2);
- if (a1.es_buit() and a2.es_buit()) {
- if (r.esPC(arrel)) {
- insertarLista(l, arrel);
- altura = 1;
- n = arrel;
- }
- }
- else {
- list<string> l1, l2;
- string n1, n2;
- int alt1 = 0, alt2 = 0;
- i_buscarAreaTematica1 (a1, r, l1, n1, alt1);
- i_buscarAreaTematica1 (a2, r, l2, n2, alt2);
- if (l1.size() == r.longitudPalabrasClave() and l2.size() == r.longitudPalabrasClave()) {
- //las dos listas tienen todas las palabras clave
- if (alt1 == alt2) {
- //si alturas iguales elegir el de menor orden alfabetico
- if (n1 < n2) {
- n = n1;
- }
- else {
- n = n2;
- }
- altura = alt1+1;
- l = l1;
- }
- //sino elegir la mas precisa
- else if (alt1 > alt2) {
- n = n1;
- l = l1;
- altura = alt1;
- }
- else {
- n = n2;
- l = l2;
- altura = alt2;
- }
- }
- else if (l1.size() == r.longitudPalabrasClave() or l2.size() == r.longitudPalabrasClave()) {
- //una de las dos listas tiene todas las palabras clave
- if (l1.size() == r.longitudPalabrasClave()) {
- //l1 las tiene todas
- if (r.esPC(n1) {
- //si n1 pc => pc.size() = 1 => at1 = pc = n1;
- n = n1;
- l = l1;
- altura = alt1+1;
- }
- else {
- //si n1 ¬pc => pc.size() > 1 => ?
- }
- }
- else {
- //sino l2 las tiene todas
- }
- }
- else {
- fusionarListas(l1,l2);
- if (l1.size() == r.longitudPalabrasClave()) {
- n = arrel;
- l = l1;
- }
- if (alt1 > alt2)
- altura = alt1;
- else
- altura = alt2;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement