Data Structures UFC  1.0.0
Essential Data Structures for C language
sort.h
Go to the documentation of this file.
1 
13 #ifndef SORT_H
14 #define SORT_H
15 
16 #ifndef Type
17 #define Type int
18 #endif
19 #ifndef TypeFormat
20 #define TypeFormat "%d"
21 #endif
22 
23 /**********************/
24 /* SORTING ALGORITHMS */
25 /**********************/
26 
27 /* Apply BubbleSort Algorithm on the v */
28 void bubblesort(Type *v, int n);
29 
30 /* Apply the InsertionSort Algorithm on the v */
31 void insertionsort(Type *v, int n);
32 
33 /* Apply the MergeSort Algorithm on the v */
34 void mergesort(Type *v, int n);
35 
36 /* Apply the QuickSort Algorithm on the v */
37 void quicksort(Type *v, int n);
38 
39 /* Apply the HeapSort Algorithm on the v */
40 void heapsort(Type *v, int n);
41 
42 /*********/
43 /* UTILS */
44 /*********/
45 
46 
47 /* Print the v in a pretty format */
48 void print_vector(Type *v, int n);
49 
50 /* Swap the values between e1 and e2 */
51 void swap(Type *e1, Type *e2);
52 
53 /* Check if the vector v is sorted */
54 int check_sorted(Type *v, int n);
55 
56 /* Return a random_vector with n values */
57 Type* random_vector(int n);
58 
59 #endif
void swap(Type *e1, Type *e2)
void insertionsort(Type *v, int n)
int check_sorted(Type *v, int n)
void mergesort(Type *v, int n)
void print_vector(Type *v, int n)
void quicksort(Type *v, int n)
Type * random_vector(int n)
void bubblesort(Type *v, int n)
void heapsort(Type *v, int n)