A collection of sorting algorithms implemented in C to see the advantages and disadvantages of each one of them
with Time Compexity
In order to use this ,
Clone This Repo
git clone https://github.com/Theemiss/sorting_algorithms.git
Creat your main file with specifc Requirment
compile it with
gcc 4.8.4 -Wall -Werror -Wextra -pedantic {File Name Based on the sort You want} print_array.c print_list.c -o sort
.
You can then run it by invoking ./sort
in that same directory.
A slow sorting algorithm for the simplest data sets
Case | Performance |
---|---|
Worst case performance | O(n^2) |
Best case performance | O(n) |
Average case performance | O(n^2) |
Selection sort is noted for its simplicity, and it has performance advantages over more complicated algorithms in certain situations
Case | Performance |
---|---|
Worst case performance | O(n^2) |
Best case performance | O(n^2) |
Average case performance | O(n^2) |
Quick Sort is a recursive sorting algorithm that is more effective than other O(nlogn) algorithms for large datasets that fit in memory, but is unstable. Quick Sort in general does not requiere extra space
Case | Performance |
---|---|
Worst case performance | O(n^2) |
Best case performance | O(n log n) |
Average case performance | O(n log n) |