Data Structures Lerax 1.0.0
Essential Data Structures for C language
Loading...
Searching...
No Matches
sort.h
Go to the documentation of this file.
1
12
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 */
28void bubblesort(Type *v, int n);
29
30/* Apply the InsertionSort Algorithm on the v */
31void insertionsort(Type *v, int n);
32
33/* Apply the MergeSort Algorithm on the v */
34void mergesort(Type *v, int n);
35
36/* Apply the QuickSort Algorithm on the v */
37void quicksort(Type *v, int n);
38
39/* Apply the HeapSort Algorithm on the v */
40void heapsort(Type *v, int n);
41
42/* Apply the RadixSort Algorithm on the v */
43void radixsort(Type *v, int n);
44
45/* Apply the SelectionSort Algorithm on the v */
46void selectionsort(Type *v, int n);
47
48/*********/
49/* UTILS */
50/*********/
51
52
53/* Print the v in a pretty format */
54void print_vector(Type *v, int n);
55
56
57/* Swap the values between e1 and e2 */
58void swap(Type *e1, Type *e2);
59
60/* Check if the vector v is sorted */
61int check_sorted(Type *v, int n);
62
63/* Return a random_vector with n values */
64Type* random_vector(int n);
65
66/* Debug print vector when DEBUG symbol is defined */
67void debug_print_vector(Type *v, int n);
68
69/* Debug print vector DEBUG symbol is defined */
70void debug(const char *format, ...);
71
72#endif
void bubblesort(Type *v, int n)
void quicksort(Type *v, int n)
void print_vector(Type *v, int n)
void insertionsort(Type *v, int n)
Type * random_vector(int n)
void selectionsort(Type *v, int n)
void swap(Type *e1, Type *e2)
void radixsort(Type *v, int n)
int check_sorted(Type *v, int n)
void heapsort(Type *v, int n)
void debug(const char *format,...)
void debug_print_vector(Type *v, int n)
void mergesort(Type *v, int n)