-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsort.h
68 lines (62 loc) · 1.61 KB
/
sort.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Licensed under the MIT License.
#include <stddef.h>
#include "array.h"
#include "comparer.h"
/** Defines a sorting algorithm. */
typedef void (*Sort)(
Array items,
size_t count,
size_t itemSize,
Comparer itemComparer);
/**
* Sorts a collection using the bubble sort algorithm.
*
* @param items the collection of items.
* @param count the number of items.
* @param itemSize the size of each item.
* @param itemComparer the item comparer.
*/
void bubble_sort(
Array items,
size_t count,
size_t itemSize,
Comparer itemComparer);
/**
* Sorts a collection using the selection sort algorithm.
*
* @param items the collection of items.
* @param count the number of items.
* @param itemSize the size of each item.
* @param itemComparer the item comparer.
*/
void selection_sort(
Array items,
size_t count,
size_t itemSize,
Comparer itemComparer);
/**
* Sorts a collection using the insertion sort algorithm.
*
* @param items the collection of items.
* @param count the number of items.
* @param itemSize the size of each item.
* @param itemComparer the item comparer.
*/
void insertion_sort(
Array items,
size_t count,
size_t itemSize,
Comparer itemComparer);
/**
* Sorts a collection using the merge sort algorithm.
*
* @param items the collection of items.
* @param count the number of items.
* @param itemSize the size of each item.
* @param itemComparer the item comparer.
*/
void merge_sort(
Array items,
size_t count,
size_t itemSize,
Comparer itemComparer);