-
Notifications
You must be signed in to change notification settings - Fork 0
/
sort.h
37 lines (33 loc) · 824 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
#ifndef SORT_H
#define SORT_H
/*
* insertion_sort(int *A, int len)
* - perform insertion sort on array A of length len
*
* asymptotic complexity: O(n^2)
*
*/
void insertion_sort(int *A, int len);
/*
* merge_sort(int *A, int len)
* - perform merge sort on an array A of length len
*
* asymptotic complexity: O(n lg n) where lg is log base 2
*
* downsides: uses space for temporary arrays
*
*/
void merge_sort(int *A, int len);
/*
* quick_sort(int *A, int len)
* - perform quick sort on an array A of length len
*
* asymptotic complexity:
* - worst case performance is O(n^2) but this is
* exceptionally uncommon
* - average case performance is O(n lg n) which is
* which important given the use of a randomized
* paritioning subroutine
*/
void quick_sort(int *A, int len);
#endif