|
|
|
@ -22,7 +22,7 @@
|
|
|
|
|
#include "random.h"
|
|
|
|
|
#include "timer.h"
|
|
|
|
|
#include "bubble_sort.h"
|
|
|
|
|
#include "count_sort.h"
|
|
|
|
|
#include "counting_sort.h"
|
|
|
|
|
#include "quick_sort.h"
|
|
|
|
|
#include "bitonic_sort.h"
|
|
|
|
|
#include "selection_sort.h"
|
|
|
|
@ -49,7 +49,7 @@ void print_usage() {
|
|
|
|
|
fprintf(stdout, " -q, --quick usar quick sort\n");
|
|
|
|
|
fprintf(stdout, " -b, --bubble usar bubble sort\n");
|
|
|
|
|
fprintf(stdout, " -B, --bitonic usar bitonic sort\n");
|
|
|
|
|
fprintf(stdout, " -c, --count usar ordenamiento por conteo\n");
|
|
|
|
|
fprintf(stdout, " -c, --counting usar ordenamiento por conteo\n");
|
|
|
|
|
fprintf(stdout, " -s, --selection usar ordenamiento por selección\n");
|
|
|
|
|
fprintf(stdout, " -n, --n=N la cantidad de elementos a ordenar, la\n");
|
|
|
|
|
fprintf(stdout, " cantidad predeterminado es 10\n");
|
|
|
|
@ -183,7 +183,7 @@ int main (int argc, char **argv) {
|
|
|
|
|
int quick = 0;
|
|
|
|
|
int bubble = 0;
|
|
|
|
|
int bitonic = 0;
|
|
|
|
|
int count = 0;
|
|
|
|
|
int counting = 0;
|
|
|
|
|
int selection = 0;
|
|
|
|
|
int opt;
|
|
|
|
|
int long_index = 0;
|
|
|
|
@ -193,7 +193,7 @@ int main (int argc, char **argv) {
|
|
|
|
|
{"quick", no_argument, 0, 'q'},
|
|
|
|
|
{"bubble", no_argument, 0, 'b'},
|
|
|
|
|
{"bitonic", no_argument, 0, 'B'},
|
|
|
|
|
{"count", no_argument, 0, 'c'},
|
|
|
|
|
{"counting", no_argument, 0, 'c'},
|
|
|
|
|
{"selection", no_argument, 0, 's'},
|
|
|
|
|
{"n", required_argument, 0, 'n'},
|
|
|
|
|
{"elegir", no_argument, 0, 'e'},
|
|
|
|
@ -215,7 +215,7 @@ int main (int argc, char **argv) {
|
|
|
|
|
quick = 1;
|
|
|
|
|
bubble = 1;
|
|
|
|
|
bitonic = 1;
|
|
|
|
|
count = 1;
|
|
|
|
|
counting = 1;
|
|
|
|
|
selection = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 'm':
|
|
|
|
@ -231,7 +231,7 @@ int main (int argc, char **argv) {
|
|
|
|
|
bitonic = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 'c':
|
|
|
|
|
count = 1;
|
|
|
|
|
counting = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 's':
|
|
|
|
|
selection = 1;
|
|
|
|
@ -296,7 +296,7 @@ int main (int argc, char **argv) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!merge && !quick && !bubble && !bitonic && !count && !selection) {
|
|
|
|
|
if (!merge && !quick && !bubble && !bitonic && !counting && !selection) {
|
|
|
|
|
fprintf(stderr, "Error: No se seleccionó un algoritmo valido!\n");
|
|
|
|
|
print_usage();
|
|
|
|
|
return 4;
|
|
|
|
@ -351,8 +351,8 @@ int main (int argc, char **argv) {
|
|
|
|
|
end_sort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// O(n^2)
|
|
|
|
|
if (count) {
|
|
|
|
|
// O((1/2) * n^2 - (1/2) * n)
|
|
|
|
|
if (counting) {
|
|
|
|
|
start_sort("Count sort corriendo... ", n);
|
|
|
|
|
count_sort(work_array, n);
|
|
|
|
|
end_sort();
|
|
|
|
|