X-Git-Url: https://git.llucax.com/z.facultad/75.06/jacu.git/blobdiff_plain/8f161fb90db32293100c689806720acde9844b00..0189fdaa9744c0aeddcf72ca0f3f7fa3981e53a2:/otros/mtf/mtf.c diff --git a/otros/mtf/mtf.c b/otros/mtf/mtf.c index 993b9da..3113161 100644 --- a/otros/mtf/mtf.c +++ b/otros/mtf/mtf.c @@ -5,7 +5,7 @@ int no_pertenece(char *z, char c, int len); void pop_front(char *z, int pos); -/*int get_pos(char *z, int len, char c);*/ +int get_pos(char *z, int len, char c); /****fin privadas******/ void print_z(char *z, int len) @@ -16,16 +16,6 @@ void print_z(char *z, int len) fprintf(stderr, "\n"); } -int comparar(const void *d1, const void *d2) -{ - char *c1, *c2; - - c1 = (char *)d1; - c2 = (char *)d2; - - return (*c1) - (*c2); -} - int *jacu_mtf(char *datos, int len) { char *z; @@ -34,21 +24,10 @@ int *jacu_mtf(char *datos, int len) pos = (int*)malloc(len*sizeof(int)); z = jacu_buscar_z(datos, len, &size); - fprintf(stderr, "Z original = "); - print_z(z, size); - fprintf(stderr, "SIZE = %d\n", size); - /*z[0]='A';z[1]='B';z[2]='C';z[3]='D';z[4]='R';*/ - /* Ordeno */ - qsort(z, size, 1, comparar); - fprintf(stderr, "Z ordenado = "); - print_z(z, size); - for(i=0; i