Crates.io | algorithm_playground |
lib.rs | algorithm_playground |
version | 1.0.2 |
source | src |
created_at | 2024-03-04 09:14:42.860472 |
updated_at | 2024-03-05 06:52:16.44212 |
description | Algorithms Playground: To learn and understand the working of different algorithms in Computer Science. |
homepage | |
repository | |
max_upload_size | |
id | 1161419 |
size | 25,015 |
Algorithm Playground is a Rust library that provides implementations of various searching algorithms.
PartialEq
or Ord
trait.To use Algorithm Playground in your Rust project, add it as a dependency in your Cargo.toml
file:
[dependencies]
algorithm_playground = "1.0.2"
Here's an example of how to use the searching algorithms in your Rust code:
use algorithm_playground::algorithms::searching::searching::{linear_search, binary_search};
fn main() {
let arr = vec![1, 2, 3, 4, 5];
// Perform linear search
match linear_search(&arr, &3) {
Some(index) => println!("Found 3 at index {}", index),
None => println!("3 not found"),
}
// Perform binary search (requires sorted array)
match binary_search(&arr, &3) {
Some(index) => println!("Found 3 at index {}", index),
None => println!("3 not found"),
}
}
Contributions to Algorithm Playground are welcome! If you find a bug or have a feature request, please open an issue on GitHub. Pull requests are also appreciated.
This project is licensed under the MIT License - see the LICENSE file for details.