sort-rs 0.1.2

A crate exposing sorting algorithms
Documentation
  • Coverage
  • 0%
    0 out of 6 items documented0 out of 5 items with examples
  • Size
  • Source code size: 8.06 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.13 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • siddharthborderwala/sort-rs
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • siddharthborderwala

sort-rs

A repository with various sorting algorithms

List of Algorithms

  1. Bubble Sort
  2. Selection Sort
  3. Insertion Sort
  4. Merge Sort
  5. Quick Sort

Use as a external crate

extern crate sort;

use sort::quick_sort;

fn main() {
  let mut list_of_numbers = [4, 2, 7, 5, 1, 3];
  quick_sort(&mut list_of_numbers);
  assert_eq!(list_of_numbers, [1, 2, 4, 5, 7]);
}
extern crate sort;

use sort::insertion_sort;

fn main() {
  let mut list_of_chars = ['s', 'y', 's', 't', 'e', 'm'];
  insertion_sort(&mut list_of_chars)
  assert_eq!(list_of_numbers, ['e', 'm', 's', 's', 't', 'y']);
}

CLI

Options

$ cargo run -- <bubble|selection|insertion|merge|quick> <comma-separated list of integers>

For example

$ cargo run -- merge "12,54,33,27,19,23,44"
> [12, 19, 23, 27, 33, 44, 54]

How to build

Make sure you have rust-toolchain installed to build the executable

For windows only

$ ./release.sh

How to run

After you have built the executable, run the following

$ ./build/sorter.exe <algorithm-option> <comma-separated list of integers>