Пример #1
0
NODO *special_find(NODO * arbol, int *g, int* matcheado)
{
    NODO *temp;
    int j=1;
    int gprima;
    int auxletra;
    auxletra = s_i(S2, j);
    //printf("1 %d\n", auxletra);
    if (arbol->hijos[auxletra]!=NULL) temp = buscarHijo(arbol, j, S2);
    else return arbol;
    //printf("2\n");
    gprima = longPath(temp);
    while(*matcheado+gprima<=strlen(S2)){
       if(cmpString(temp->from, j, j+gprima-1, S1, S2)==gprima){
    //printf("a\n");
          temp->posS2 = 1;
          *matcheado=*matcheado+gprima;
          j=j+gprima;
          auxletra = s_i(S2, j);
          if (temp->hijos[auxletra]!=NULL){
    //printf("a2\n");
              temp = buscarHijo(temp, j, S2);
              gprima=longPath(temp);
          }
          else{
    //printf("a3\n");
             *g=gprima;
              return temp;
          }
       }
       else{
    //printf("b\n");
          *g=cmpString(temp->from, j, j+gprima-1, S1, S2);
          *matcheado=*matcheado+*g;
          return temp;
       }
    }
    //printf("3\n");
    *g=cmpString(temp->from, j, strlen(S2), S1, S2);
    *matcheado=*matcheado+*g;
    return temp;
}
Пример #2
0
void sort(char** file, int size)
{
	int i = 0;
	int j = 0;
	for(i = 0; i < size - 1; ++i)
	{
		for(j = 0; j < size - 1; ++j)
		{
			if(cmpString(file[j], file[j + 1]) == 1)
			{
				swap(&file[j], &file[j + 1]);
			}
		}
	}
}