This repository contains my implementations of basic sorting algorithms as part of my self-guided programming journey. Each file represents one algorithm, written from scratch in Python.
-
Bubble Sort
A basic comparison-based algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if needed. -
Insertion Sort
Builds the final sorted list one item at a time by inserting each new element into its correct position in the sorted part. -
Bogo Sort
A chaotic and inefficient sort that randomly shuffles the list until it happens to be sorted. Implemented for fun and learning purposes only. -
Merge Sort
Recursively splits the list into halves, sorts each half, and merges them back together in sorted order. -
Selection Sort
A simple comparison-based algorithm that repeatedly selects the smallest element from the unsorted part of the list and swaps it into its correct position. -
Lexicographic Permuation Sort
A permutation-based sort that shuffles through parallel realities (viaitertools.permutations
) until the sorted one is observed.
To run an algorithm, use for example:
python bubble_sort.py
Or open and modify the list directly in the file. Each script runs independently.
Time all algorithms and see which one is the fastest (coming soon)