From efbfacc87590729a6790eecee98b91d55615f881 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicol=C3=A1s=20Dimov?= Date: Sun, 20 Jun 2004 01:17:14 +0000 Subject: [PATCH 1/1] arreglos minimos, saco los printf feos --- otros/mtf/main.c | 2 -- otros/mtf/mtf.c | 26 ++------------------------ otros/mtf/mtf.h | 2 -- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/otros/mtf/main.c b/otros/mtf/main.c index 3ef990e..38652da 100644 --- a/otros/mtf/main.c +++ b/otros/mtf/main.c @@ -9,7 +9,6 @@ int main(int argc, char *argv[] ) int *pos; int len; int i; - len = fread(buff, 1, BUFSIZ, stdin); buff[len] = '\0'; @@ -23,4 +22,3 @@ int main(int argc, char *argv[] ) return 0; } - 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