| Crates.io | search-sort |
| lib.rs | search-sort |
| version | 0.3.1 |
| created_at | 2021-07-22 12:25:53.688532+00 |
| updated_at | 2021-07-30 14:24:17.470843+00 |
| description | Implementation of few searching and sorting algorithms |
| homepage | |
| repository | https://github.com/piernczk/search-sort-rs |
| max_upload_size | |
| id | 425882 |
| size | 18,216 |
Implementation of few searching and sorting algorithms. This crate is currently WIP, and supports only few of them.
Searching algorithms to be implemented:
Sorting algorithms to be implemented:
Add this to your Cargo.toml file:
[dependencies]
search-sort = "0.3"
This code sorts the slice and searches for elements in it:
use search_sort::{search, sort};
let mut slice = [5, 1, 91, -45, 11, 5];
sort::quick(&mut slice);
assert_eq!(slice, [-45, 1, 5, 5, 11, 91]);
assert_eq!(Some(2), search::binary_first(&slice, &5));
assert_eq!(None, search::binary_first(&slice, &42));
This code is released under the MIT license. See the LICENSE.md file.