Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.18 KB | None | 0 0
  1. int validar_depend_circular(){ //Bueno
  2.     int res=0,i,j,k,l;
  3.     trab *nodo, *nodo2;
  4.     for(i=0; i<queue_size(tbd_queue); i++){
  5.         nodo=(trab*)queue_at(tbd_queue, i);
  6.         char *aux=(char*)malloc(MAX_LINE_SIZE+1*sizeof(char));
  7.         aux=nodo->llave;
  8.         printf("primer nodo llave; %s\n", aux);
  9.         for(j=0; j<queue_size(nodo->depend); j++){
  10.             char *aux2=(char*)malloc(MAX_LINE_SIZE+1*sizeof(char));
  11.             aux2=(char *)queue_at(nodo->depend, j); //Cada dependencia de cada nodo
  12.             printf("nodo depen de llave 1; %s... %s\n", aux, aux2);
  13.             for(k=0; k<queue_size(tbd_queue); k++){
  14.                 nodo2=(trab*)queue_at(tbd_queue, k);
  15.                 char *aux3=(char*)malloc(MAX_LINE_SIZE+1*sizeof(char));
  16.                 aux3=nodo2->llave;
  17.                 printf("segundo nodo llave 2; %s\n", aux3);
  18.                 if (strcmp(aux2,aux3) == 0){
  19.                     for(l=0; l<queue_size(nodo2->depend); l++){
  20.                         char *aux4=(char*)malloc(MAX_LINE_SIZE+1*sizeof(char));
  21.                         aux4=(char *)queue_at(nodo2->depend, l); //Cada dependencia de cada nodo
  22.                         printf("dependencias nodo 2; %s... %s\n", aux3, aux4);
  23.                             if (strcmp(aux4,aux) == 0){
  24.                                 printf("existe\n");
  25.                                 res=1;
  26.                                 return res;
  27.                             }
  28.                     }
  29.                     break;
  30.                 }
  31.             }
  32.         }
  33.     }
  34.     return res;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement