la seguente funzione dovrebbe stabilire se esiste un cammino che ci permette di totalizzare un determinato punteggio... solo che non mi va...
la chiamata è la seguente:
mentre la funzione:codice:bool esiste = esiste_cammino(tree,0,15);
graziecodice:bool esiste_cammino(nodo *t,int tot,int punteggio){ if (t == NULL){ return false; } if (foglia(t) && tot==punteggio) return true; else return false; bool l = esiste_cammino(t->left,tot+t->info,punteggio); bool r = esiste_cammino(t->right,tot+t->info,punteggio); if ((l == true) || (r == true)) return true; return false; }


Rispondi quotando
