4 releases
0.1.3 | Aug 22, 2021 |
---|---|
0.1.2 | Aug 21, 2021 |
0.1.1 | Aug 21, 2021 |
0.1.0 | Aug 21, 2021 |
#2292 in Algorithms
12KB
207 lines
hidden_median
Finds the hidden median of 2 sorted arrays in Olog(min(a, b))
time.
This crate works with both arrays and vectors. Also, I have avoided recursion
and while-loop for minimizing runtime strikes, instead used a plain for loop
that runs only Olog(min(a, b))
times.
In short, this is hidden_median
crate for you. lets look at a quick example!
Quick Start
use hidden_median::interface::Holder;
fn main() {
let list_a = [-3, -1, 5, 6];
let list_b = [-7, -2, 4, 8, 11];
let mut holder = Holder::new(&list_a, &list_b);
let result = holder.init().result();
// `result` is a tuple, that comes with a help text!
println!("{:?}", result);
// output: (4, 4, "median is a single number.")
}
Version Note: changed the readme