Skip to content

πŸ”§ Educational C implementations of classic sorting algorithms: Bubble, Insertion, Selection, and Substitution sorts.

Notifications You must be signed in to change notification settings

Abega1642/sorting-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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

About

πŸ”§ Educational C implementations of classic sorting algorithms: Bubble, Insertion, Selection, and Substitution sorts.

Topics

Resources

Stars

Watchers

Forks