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)
{
int i;
for(i=0; i<len; i++)
- printf("%c", z[i]);
- printf("\n");
+ fprintf(stderr, "%c", z[i]);
+ fprintf(stderr, "\n");
}
-
int *jacu_mtf(char *datos, int len)
{
char *z;
pos = (int*)malloc(len*sizeof(int));
z = jacu_buscar_z(datos, len, &size);
- printf("Z original = ");
- print_z(z, size);
- printf("SIZE = %d\n", size);
- z[0]='A';z[1]='B';z[2]='C';z[3]='D';z[4]='R';
for(i=0; i<len; i++){
pos[i] = get_pos(z, size, datos[i]);
- printf("vino %c emiti: %d\n",datos[i], pos[i]);
if (pos[i] != 0)
pop_front(z,pos[i]);
- print_z(z, size);
}
return pos;
}
char *z;
int i, j=0;
- z = NULL; /*(char*)malloc(1);*/
- /*if (z==NULL) return NULL;*/
+ z = NULL;
for(i=0; i<len; i++){
if( no_pertenece(z, datos[i], j) == -1 ){
j++;