order the algorithms from worse to best
This commit is contained in:
parent
6ff4147448
commit
369f41c886
24
src/sort.c
24
src/sort.c
@ -325,36 +325,42 @@ int main (int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (merge) {
|
// O(nlog(n))
|
||||||
start_sort("Merge sort corriendo... ", n);
|
|
||||||
merge_sort(work_array, n);
|
|
||||||
end_sort();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (quick) {
|
if (quick) {
|
||||||
start_sort("Quick sort corriendo... ", n);
|
start_sort("Quick sort corriendo... ", n);
|
||||||
quick_sort(work_array, n);
|
quick_sort(work_array, n);
|
||||||
end_sort();
|
end_sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bubble) {
|
// O(nlog(n))
|
||||||
start_sort("Bubble sort corriendo... ", n);
|
if (merge) {
|
||||||
bubble_sort(work_array, n);
|
start_sort("Merge sort corriendo... ", n);
|
||||||
|
merge_sort(work_array, n);
|
||||||
end_sort();
|
end_sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// O(nlog2(n))
|
||||||
if (bitonic) {
|
if (bitonic) {
|
||||||
start_sort("Bitonic sort corriendo... ", n);
|
start_sort("Bitonic sort corriendo... ", n);
|
||||||
bitonic_sort(work_array, n);
|
bitonic_sort(work_array, n);
|
||||||
end_sort();
|
end_sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// O(n+k)
|
||||||
if (count) {
|
if (count) {
|
||||||
start_sort("Count sort corriendo... ", n);
|
start_sort("Count sort corriendo... ", n);
|
||||||
count_sort(work_array, n);
|
count_sort(work_array, n);
|
||||||
end_sort();
|
end_sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// O(n^2)
|
||||||
|
if (bubble) {
|
||||||
|
start_sort("Bubble sort corriendo... ", n);
|
||||||
|
bubble_sort(work_array, n);
|
||||||
|
end_sort();
|
||||||
|
}
|
||||||
|
|
||||||
|
// O(n^2)
|
||||||
if (selection) {
|
if (selection) {
|
||||||
start_sort("Selection sort corriendo... ", n);
|
start_sort("Selection sort corriendo... ", n);
|
||||||
selection_sort(work_array, n);
|
selection_sort(work_array, n);
|
||||||
|
Loading…
Reference in New Issue
Block a user