Yes, I do. But I have to use fib_super_fast(n, 1, 1, 0) as my other implementations also begin with 1. The code for calling the fibonacci methods is:
fn main() { loop { println!("Enter n:"); let mut n_str = String::new(); io::stdin().read_line(&mut n_str).expect("Failed to read line"); let n = user_input_to_int(n_str); let t0 = SystemTime::now(); let fib_super_fast_n = fib_super_fast(n, 1, 1, 0); let t1 = SystemTime::now(); println!("fib_super_fast(n) = {} ({}µs)", fib_super_fast_n, time_difference(t0, t1)); let t0 = SystemTime::now(); let fib_fast_n = fib_fast(n); let t1 = SystemTime::now(); println!("fib_fast(n) = {} ({}µs)", fib_fast_n, time_difference(t0, t1)); let t0 = SystemTime::now(); let fib_n = fib(n); let t1 = SystemTime::now(); println!("fib(n) = {} ({}µs)", fib_n, time_difference(t0, t1)); } }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yes, I do. But I have to use fib_super_fast(n, 1, 1, 0) as my other implementations also begin with 1. The code for calling the fibonacci methods is: