- generar_array(in, array, len);
- ordenar_array(in, array, len);
- (*k) = generar_salida(in, array, out, len);
+ for(i=0; i<len; i++) {
+ in[i].c = c[i];
+ in[i].pos = i;
+ }
+
+ qsort(in, len, sizeof(t_BlockSortDecode), _compare);
+
+ current = k;
+ i=0;
+ do {
+ dst[i++] = in[current].c;
+ current = in[current].pos;
+ } while (current != k);
+ free(in);
+}
+
+t_BlockSort *bs_create(unsigned int len)
+{
+ t_BlockSort *tmp;
+
+ tmp = malloc(sizeof(t_BlockSort));
+ tmp->array = malloc(sizeof(t_BlockSortData)*len);
+ tmp->ord = malloc(sizeof(unsigned long int)*len);
+ tmp->len = len;