-
Notifications
You must be signed in to change notification settings - Fork 0
/
sort.h
45 lines (35 loc) · 1.04 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 <stddef.h>
#include <stdio.h>
#include <stdlib.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; /* Value stored in node (int) */
struct listint_s *prev; /* pointer to previous node */
struct listint_s *next; /* Pointer to next */
} listint_t; /* End struct */
void print_list(const listint_t *list);
void print_array(const int *array, size_t size);
/* Task #0 */
void swap_element(int *array, int a, int b);
void bubble_sort(int *array, size_t size);
/* Task #1 */
void insertion_sort_list(listint_t **list);
/* Task #2 */
void selection_sort(int *array, size_t size);
/* Task #3 */
void quick_sort(int *array, size_t size);
void quick_sort_lomuto(int *array, size_t low, size_t high, size_t size);
/* Task #4 */
void shell_sort(int *array, size_t size);
/* Task #5 */
void cocktail_sort_list(listint_t **list);
#endif