-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsort.h
More file actions
111 lines (92 loc) · 3.93 KB
/
sort.h
File metadata and controls
111 lines (92 loc) · 3.93 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
*********************************************************************************************************
* MODULE
*
* Note(s) : (1) This definition header file is protected from multiple pre-processor inclusion
* through use of the definition module present pre-processor macro definition.
*********************************************************************************************************
*/
#ifndef __SORT_H
#define __SORT_H
/*
*********************************************************************************************************
* INCLUDE FILES
*********************************************************************************************************
*/
#include "algorithm_def.h"
/* Include compare and sort function address. */
#include "compare.h"
#include "modify_sequence.h"
/*
*********************************************************************************************************
* DEFINES
*********************************************************************************************************
*/
/* Configure if enable sort debug. */
#define SORT_CFG_DEBUG_EN 1
/* Configure default compare function address. */
#define SORT_CFG_DEFAULT_COMPARE_ADDRESS \
(&compare_control_greater)
/* Configure default sort function address. */
#define SORT_CFG_DEFAULT_SWAP_ADDRESS \
(&modify_sequence_control_swap)
/*
*********************************************************************************************************
* DATA TYPES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
*********************************************************************************************************
*/
/**
* @brief This function will sort the object by the comp and the sort algorithm is distinguished by
* the sort_algorithm_addr that will get by xxx_convert_type_to_func_addr_table().
*
* @param type the type of sort algorithm
* @param package the package of sort algorithm
* @param left the leftmost index of the element
* @param right the rightmost index of the element
*
* @return void
*/
errno_t sort_control(enum sort_algorithm_type type,
struct sort_package_s package,
size_t left,
size_t right);
/**
* @brief This function will sort the object by the bubble sort algorithm.
*
* @param package the package of sort algorithm
* @param left the leftmost index of the element
* @param right the rightmost index of the element
*
* @return void
*/
errno_t sort_control_bubble_sort(struct sort_package_s sort_package,
size_t left,
size_t right);
/**
* @brief This function will sort the object by the quick sort algorithm.
*
* @param package the package of sort algorithm
* @param left the leftmost index of the element
* @param right the rightmost index of the element
*
* @return void
*/
errno_t sort_control_quick_sort(struct sort_package_s package,
size_t left,
size_t right);
/*
*********************************************************************************************************
* EXTERN GLOBAL VARIABLES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* MODULE END
*********************************************************************************************************
*/
#endif // !__SORT_H