-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathsort.h
47 lines (38 loc) · 941 Bytes
/
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
/**
* @file sort.h
* @author Richard Tang
* @brief array sorting
* @version 0.1
* @date 2019-02-12
*
* @copyright Copyright (c) 2019
*
*/
#ifndef __SORT_H__
#define __SORT_H__
//////////////////////////////// QUICKSORT ///////////////////////////////
#define SWAP(x,y) {int t; t = x; x = y; y = t;}
/**
* @brief
*
* @param array
* @param low
* @param high
* @return int
*/
static int partition(int *number, int left, int right);
/**
* @brief sort a array section
*
* @param array a array that needs to sort
* @param low begin of data section min:1 max:n ,and the first elem is intermediate variable!!!!
* @param high end of data section
*/
extern void quicksort(int *number, int left, int right);
////////////////////////////////////////////////////////////////////////////
/*
eg:
int TEST[] = {0,45,12,56,45};
QuickSort(TEST,1,4);
*/
#endif