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/*********/
43/* UTILS */
44/*********/
45
46
47/* Print the v in a pretty format */
48void print_vector(Type *v, int n);
49
50/* Swap the values between e1 and e2 */
51void swap(Type *e1, Type *e2);
52
53/* Check if the vector v is sorted */
54int check_sorted(Type *v, int n);
55
56/* Return a random_vector with n values */
57Type* random_vector(int n);
58
59#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 swap(Type *e1, Type *e2)
int check_sorted(Type *v, int n)
void heapsort(Type *v, int n)
void mergesort(Type *v, int n)