Skip to content

Martan03/SortingAlgs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C Sorting Algorithms

Bubble sort

Bubble sort like algorithms:

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

void select_sort(double* nums, int len);

Insertion sort

void insert_sort(double* nums, int len);

Quick sort

void quick_sort(double* nums, int len);

Merge sort

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:
image

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

Links

Releases

No releases published

Packages

No packages published