https://github.com/martan03/sortingalgs
C Sorting Algorithms
https://github.com/martan03/sortingalgs
c c-lang sort sorting-algorithms
Last synced: 3 days ago
JSON representation
C Sorting Algorithms
- Host: GitHub
- URL: https://github.com/martan03/sortingalgs
- Owner: Martan03
- Created: 2022-11-29T21:32:45.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-01-10T21:10:53.000Z (over 2 years ago)
- Last Synced: 2025-10-30T09:40:40.257Z (8 months ago)
- Topics: c, c-lang, sort, sorting-algorithms
- Language: C
- Homepage:
- Size: 759 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# C Sorting Algorithms
## Bubble sort
Bubble sort like algorithms:
```C
void bubble_sort(double* nums, int len);
void bubble_sort_optimised(double* nums, int len);
void bubble_sort_improved(double* nums, int len);
void bubble_sort_recursive(double* nums, int len);
void coctail_sort(double* nums, int len);
```
## Selection sort
```C
void select_sort(double* nums, int len);
```
## Insertion sort
```C
void insert_sort(double* nums, int len);
```
## Quick sort
```C
void quick_sort(double* nums, int len);
```
## Merge sort
```C
void merge_sort(double* nums, int len);
```
# Testing
I wanted to find out, how much time it takes each algorithm to sort an array,
so I tested it. Each algorithm sorts ascending array, descending array and
array with random numbers.
Bubble sort algorithms take a while, so I tested them with only 100.000 numbers.
There are the results:

Then I tested all other algorithms, this time with 1.000.000 numbers:

## Links
- **Author:** [Martan03](https://github.com/Martan03)
- **GitHub repository:** [SortingAlgs](https://github.com/Martan03/SortingAlgs)
- **Author website:** [martan03.github.io](https://martan03.github.io)