SHARE
TWEET

1b

matheus__serpa Jun 17th, 2019 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void insere_ite(Nodo **arvore, char info){
  2.     Nodo *aux;
  3.     Nodo *no = (Nodo *) malloc(sizeof(Nodo));
  4.     no->info = info;
  5.     no->esq = NULL;
  6.     no->dir = NULL;
  7.     printf("Insere %c - Ite\n", info);
  8.     if(*arvore == NULL){
  9.         *arvore = no;
  10.     }
  11.     else{
  12.         for(aux = *arvore; aux != NULL; ){
  13.             if(info >= aux->info){
  14.                 if(aux->dir == NULL){
  15.                     aux->dir = no;
  16.                     break;
  17.                 }
  18.                 else
  19.                     aux = aux->dir;
  20.             }
  21.             else{
  22.                 if(aux->esq == NULL){
  23.                     aux->esq = no;
  24.                     break;
  25.                 }
  26.                 else
  27.                     aux = aux->esq;
  28.             }
  29.         }
  30.     }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top