Skip to content

Lin0Andy/BT2_Assignment1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Sorting Library

Usage

This Rust library crate provides sorting algorithms for sorting various types of objects. It includes implementations of Quick Sort, Selection Sort, Insertion Sort, and Merge Sort.

To use this library in your Rust project, add the following line to your 'Cargo.toml' file:

.toml file:

[dependencies] assign1 = "0.1.0"

Demo Screenshots

The code:

image

Demo of usage:

image

Examples

Here's a simple example demonstrating how to use the sorting functions provided by this library:


fn main() {
    let mut numbers = vec![3, 1, 4, 1, 5, 9, 2, 6];
    
    // Sort using Quick Sort
    quick_sort(&mut numbers);
    println!("Sorted using Quick Sort: {:?}", numbers);

    // Sort using Selection Sort
    selection_sort(&mut numbers);
    println!("Sorted using Selection Sort: {:?}", numbers);

    // Sort using Insertion Sort
    insertion_sort(&mut numbers);
    println!("Sorted using Insertion Sort: {:?}", numbers);

    // Sort using Merge Sort
    merge_sort(&mut numbers);
    println!("Sorted using Merge Sort: {:?}", numbers);
}```

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published