This project aims to learn about the main sorting algorithms: Bubble Sort, Insertion Sort, Selection Sort and Quick Sort; while evaluating the time and space complexity of each designed algorithm and the Big O notation in C language.
Holberton School teaches Full-Stack Software Engineering with a project-based approach. Sorting algorithms & Big O Notation is one of the main projects of the second trimester that covers the High-level programming of Software Engineering.
To run the algorithms you need to download the code files by clicking Download sorting_algorithms. Or by cloning this repository with the following command in your command terminal. The result will be the same regardless of the option you choose.
~$ git clone https://github.com/viajeradelaluz/sorting_algorithms.git
The compilation process uses GNU Compiler Collection (GCC) and a Linux environment like Ubuntu 20.04 LTS
. Enter the sorting_algorithms
folder and use the makefile
as follows.
Each invocation of the make
command executes a different algorithm with its respective printout on the console.
The 0-bubble_sort.c
function sorts an array of integers in ascending order using the Bubble sort algorithm.
~/sorting_algorithms$ make bubble
Output
19, 48, 99, 71, 13, 52, 96, 73, 86, 7
19, 48, 71, 99, 13, 52, 96, 73, 86, 7
19, 48, 71, 13, 99, 52, 96, 73, 86, 7
19, 48, 71, 13, 52, 99, 96, 73, 86, 7
19, 48, 71, 13, 52, 96, 99, 73, 86, 7
19, 48, 71, 13, 52, 96, 73, 99, 86, 7
19, 48, 71, 13, 52, 96, 73, 86, 99, 7
19, 48, 71, 13, 52, 96, 73, 86, 7, 99
19, 48, 13, 71, 52, 96, 73, 86, 7, 99
19, 48, 13, 52, 71, 96, 73, 86, 7, 99
19, 48, 13, 52, 71, 73, 96, 86, 7, 99
19, 48, 13, 52, 71, 73, 86, 96, 7, 99
19, 48, 13, 52, 71, 73, 86, 7, 96, 99
19, 13, 48, 52, 71, 73, 86, 7, 96, 99
19, 13, 48, 52, 71, 73, 7, 86, 96, 99
13, 19, 48, 52, 71, 73, 7, 86, 96, 99
13, 19, 48, 52, 71, 7, 73, 86, 96, 99
13, 19, 48, 52, 7, 71, 73, 86, 96, 99
13, 19, 48, 7, 52, 71, 73, 86, 96, 99
13, 19, 7, 48, 52, 71, 73, 86, 96, 99
13, 7, 19, 48, 52, 71, 73, 86, 96, 99
7, 13, 19, 48, 52, 71, 73, 86, 96, 99
7, 13, 19, 48, 52, 71, 73, 86, 96, 99
The 1-insertion_sort_list.c
function sorts a doubly linked list of integers in ascending order using the Insertion sort algorithm.
~/sorting_algorithms$ make insertion
The 2-selection_sort.c
function sorts an array of integers in ascending order using the Selection sort algorithm.
~/sorting_algorithms$ make selection
The 3-quick_sort.c
function sorts an array of integers in ascending order using the Quick sort algorithm.
~/sorting_algorithms$ make quick
test/*main*.c
- Main files in charge of the test executions of the algorithm functions.0-O
β Big O Notation for the Bubble Sort Algorithm0-bubble_sort.c
β Function implementation of the Bubble Sort Algorithm1-O
β Big O Notation for the Insertion Sort Algorithm1-insertion_sort_list.c
β Function implementation of the Insertion Sort Algorithm using a double linked list2-O
β Big O Notation for the Selection Sort Algorithm2-selection_sort.c
β Function implementation of the Selection Sort Algorithm3-O
β Big O Notation for the Quick Sort Algorithm3-quick_sort.c
β Function implementation of the Quick Sort Algorithmmakefile
- Script to compile and run the algorithm functions.README.md
β Project's descriptionprint_array.c
β Function to print all the arraysprint_list.c
β Function to print the linked listsort.h
β Main header of the program
Johanna Alfonso @viajeradelaluz |
Ornella Russo @Ella711 |
---|