AB
Abega1642/sorting-algorithms
๐ง Educational C implementations of classic sorting algorithms: Bubble, Insertion, Selection, and Substitution sorts.
Sorting Algorithms in C
This repository contains C implementations of fundamental sorting algorithms, including:
- ๐ Bubble Sort
- ๐งฉ Insertion Sort
- ๐ฅ Selection Sort
- ๐ Substitution Sort
Each algorithm is implemented in a clean and understandable way, intended for educational purposes and for those who want to better understand the mechanics of sorting at a low level.
๐ Structure
The repository is organized as follows:
sort-algorithms/
โ
โโโ include/
โ โโโ bubble_sort.h
โ โโโ selection_sort.h
โ โโโ substitution_sort.h
โ โโโ insertion_sort.h
โ โโโ test_bubble_sort.h
โ โโโ test_selection_sort.h
โ โโโ test_substitution_sort.h
โ โโโ test_insertion_sort.h
โ โโโ util.h
โ
โโโ src/ # Source implementations
โ โโโ bubble_sort.c
โ โโโ selection_sort.c
โ โโโ substitution_sort.c
โ โโโ insertion_sort.c
โ
โโโ tests/ # Unit tests
โ โโโ main_test.c
โ โโโ test_bubble_sort.c
โ โโโ test_selection_sort.c
โ โโโ test_substitution_sort.c
โ โโโ test_insertion_sort.c
โ
โโโ README.md # Project overview, usage, build instructions
โโโ CMakefileLists.txt
๐ Getting Started
โ Prerequisites
Youโll need a C compiler like gcc.
๐ง Algorithms Explained
- Bubble Sort: Repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order.
- Insertion Sort: Builds the sorted array one item at a time by comparing with the left side.
- Selection Sort: Repeatedly selects the smallest element and moves it to the sorted part.
- Substitution Sort: (Custom or lesser-known algorithm โ clarify implementation details here if applicable).
๐ Educational Purpose
This project is designed to:
- Help students understand core sorting algorithms.
- Provide a playground to test and visualize sorting behavior.
- Encourage algorithm comparison and performance analysis.
๐งโ๐ป Author
Abegร Razafindratelo