searchsort

Crates.iosearchsort
lib.rssearchsort
version0.1.0
sourcesrc
created_at2023-09-09 22:02:02.666437
updated_at2023-09-09 22:02:02.666437
descriptionA Rust trait implementing Binary Search and Quick Sort algorithms.
homepagehttps://github.com/manorajesh/searchsort
repositoryhttps://github.com/manorajesh/searchsort.git
max_upload_size
id968409
size11,936
mano (manorajesh)

documentation

README

SearchSort

A Rust trait implementing a Binary Search and the Quick Sort algorithm. Currently, they are implemented for Vec<T> types but can be expanded to other collection types.

Usage

cargo add searchsort

Examples

use searchsort::SearchSort;

let arr = vec![4, 82, 4, 32, 3, 20, 3, 2, 2, 9, 8, 7, 5, 0];
let find = 5;

assert_eq!(arr.find_me(find, 0, arr.len()-1), Some(12));

let mut arr = vec![3, 1, 4, 1, 5, 9, 2, 6, 5];
arr.quicksort();
assert_eq!(arr, [1, 1, 2, 3, 4, 5, 5, 6, 9]);

Why

This was my first time implementing the Binary Search and Quick Sort algorithms. I have a feeling this may not be the last time.

Commit count: 3

cargo fmt