sorting-algorithm

Crates.iosorting-algorithm
lib.rssorting-algorithm
version0.1.17
created_at2025-07-19 02:08:29.194206+00
updated_at2026-01-01 18:16:01.572183+00
descriptionAn implementation of various sorting algorithms
homepage
repositoryhttps://github.com/FLogan800/sorting-algorithm
max_upload_size
id1759873
size27,821
Logan (FLogan800)

documentation

README

sorting-algorithm

various sorting algorithms implemented in Rust

The current implemented sorting algorithms are:

  • Bogo Sort
  • Bubble Sort
  • Cocktail Shaker Sort
  • Comb Sort
  • Exchange Sort
  • Gnome Sort
  • Heap Sort
  • Insertion Sort
  • Merge Sort
  • Quick Sort
  • Selection Sort
  • Shell Sort

Use

The use for each algorithm is the same.

  1. Import the module for the desired algorithm
  2. Call the module's sort() function
  3. Pass a mutable pointer as an argument
use sorting_algorithm::bubble_sort;

fn main() {
    let &mut data = [3, 1, 2, 5, 4];

    bubble_sort::sort(&mut data);

    assert_eq!(data, [1, 2, 3, 4, 5]);
}
Commit count: 28

cargo fmt