-
Notifications
You must be signed in to change notification settings - Fork 0
/
sort.h
46 lines (44 loc) · 1.47 KB
/
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
#ifndef __SORT_H__
#define __SORT_H__
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
/**
* struct listint_s - Doubly linked list node
*
* @n: Integer stored in the node
* @prev: Pointer to the previous element of the list
* @next: Pointer to the next element of the list
*/
typedef struct listint_s
{
const int n;
struct listint_s *prev;
struct listint_s *next;
} listint_t;
void bubble_sort(int *array, size_t size);
void insertion_sort_list(listint_t **list);
void selection_sort(int *array, size_t size);
void quick_sort(int *array, size_t size);
void print_array(const int *array, size_t size);
void print_list(const listint_t *list);
void insertion_sort_list(listint_t **list);
void swap_node(listint_t **h, listint_t **n1, listint_t *n2);
void quick_sort(int *array, size_t size);
void sort(int *array, size_t size, int low, int high);
int partition(int *array, size_t size, int low, int high);
void swap_array(int *a, int *b);
void shell_sort(int *array, size_t size);
void counting_sort(int *array, size_t size);
void heap_sort(int *array, size_t size);
size_t list_length(listint_t *list);
void switch_node(listint_t **list, listint_t **p);
void cocktail_sort_list(listint_t **list);
void merge_subarray(int *arr, int *array, size_t low,
size_t pivot, size_t high);
void merge_recursion(int *arr, int *array, size_t low, size_t high);
void merge_sort(int *array, size_t size);
void quick_sort_hoare(int *array, size_t size);
#endif