Inserisce nell’array c il cammino percorso per trovare il nodo y

int f2(nodo *x, int *y,int *c,int top){
   if(!x) return -1;  //se l'albero è vuoto ritorno -1
   if(x->info==y) return top;
   if(x->left){
     int sx=f2(x->left,y,c,top+1);
   if(sx!=-1){
     c[top]=0;
     return sx;
   }
 }
 if(x->right){
   int dx=f2(x->right,y,c,top+1);
   if(dx!=-1){
     c[top]=1;
     return dx;
   }
 }
 return (-1);  
}
Tothebit

About Tothebit

How to whitelist website on AdBlocker?

How to whitelist website on AdBlocker?

  1. 1 Click on the AdBlock Plus icon on the top right corner of your browser
  2. 2 Click on "Enabled on this site" from the AdBlock Plus option
  3. 3 Refresh the page and start browsing the site