diff options
Diffstat (limited to 'rushs/evalexpr/insertion_sort')
| -rw-r--r-- | rushs/evalexpr/insertion_sort/insertion_sort.c | 20 | ||||
| -rw-r--r-- | rushs/evalexpr/insertion_sort/insertion_sort.h | 8 |
2 files changed, 0 insertions, 28 deletions
diff --git a/rushs/evalexpr/insertion_sort/insertion_sort.c b/rushs/evalexpr/insertion_sort/insertion_sort.c deleted file mode 100644 index 2edd195..0000000 --- a/rushs/evalexpr/insertion_sort/insertion_sort.c +++ /dev/null @@ -1,20 +0,0 @@ -#include "insertion_sort.h" - -#include <stddef.h> - -void insertion_sort(void **array, f_cmp comp) -{ - if (array == NULL || *array == NULL) - { - return; - } - for (int i = 1; array[i]; i++) - { - for (int j = i; j > 0 && comp(array[j - 1], array[j]) > 0; j--) - { - void *tmp = array[j]; - array[j] = array[j - 1]; - array[j - 1] = tmp; - } - } -} diff --git a/rushs/evalexpr/insertion_sort/insertion_sort.h b/rushs/evalexpr/insertion_sort/insertion_sort.h deleted file mode 100644 index a7ba674..0000000 --- a/rushs/evalexpr/insertion_sort/insertion_sort.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef INSERTION_SORT_H -#define INSERTION_SORT_H - -typedef int (*f_cmp)(const void *, const void *); - -void insertion_sort(void **array, f_cmp comp); - -#endif /* ! INSERTION_SORT_H */ |
