RESPUESTA A LA PREGUNTA 14113 - C/VISUAL C mira existen 3 formas de recorrer un arbol te mando las siguientes funciones ojala y te sirvan struct pila *meter(struct pila *first,struct dir *pi,int aux) { struct pila *cima,*temp; cima=first; temp=cima->sig; cima->sig=(struct pila*) malloc (sizeof(struct pila)); cima->sig->nodo=pi; cima->sig->Nodo=aux; cima->sig->sig=temp; return(first); } // *********************************************************************** struct dir *sacar(struct pila *first, int *band) { struct dir *pi; struct pila *cima,*temp; cima=first; temp=cima->sig; pi=cima->sig->nodo; *band=cima->sig->Nodo; cima->sig=cima->sig->sig; free(temp); return(pi); } // ************************************************************************ struct pila *inicia() { struct pila *first; first=(struct pila*) malloc (sizeof(struct pila)); first->sig=NULL; return(first); } // ************************************************************************ char vacia (struct pila *first) { char aux=0; if (first->sig == NULL) aux=1; return(aux); } // ************************************************************************ void preorden() { int y; int band,band2; struct dir *r,*mm,*rama; struct pila *tope; y=4; band=1; band2=1; clrscr(); // llamar a marco tope=inicia(); gotoxy(30,2);printf("RECORRIDO PREORDEN"); mm=raiz; do { while (mm!=NULL) { rama=mm; y=listaarb(y,rama); if (rama->der!=NULL) { r=rama->der; tope=meter(tope,r,0); band2=1; } mm=rama->izq; } if (vacia(tope)==0) { mm=sacar(tope,&band); } } while (mm!=NULL); getch(); band2=0; } //************************************************************************* //************************************************************************* void inorden() { int y; int band,band2; struct dir *r,*mm,*rama; struct pila *tope; y=4; band=1; band2=1; clrscr(); gotoxy(30,2);printf("RECORRIDO INORDEN"); mm=raiz; tope=inicia(); do { rama=mm; while(mm!=NULL) { r=mm; fflush(stdin); tope=meter(tope,r,0); mm=r->izq; band2=1; } while((vacia(tope)==0)&&(band2==1)) { band2=1; rama=sacar(tope,&band); y=listaarb(y,rama); if (rama->der != NULL) { band2=0; mm=rama->der; } else mm=NULL; } } while((mm!=NULL)||(vacia(tope)==0)); getch(); band2=0; } Heidy Flores flheidy@hotmail.com