MCPcopy Create free account
hub / github.com/douchuan/algorithm / fib_classic_recursive

Function fib_classic_recursive

src/dp/fib.rs:7–13  ·  view source on GitHub ↗
(n: usize)

Source from the content-addressed store, hash-verified

5/// classic impl
6#[allow(unused)]
7pub fn fib_classic_recursive(n: usize) -> usize {
8 match n {
9 0 => 0,
10 1 | 2 => 1,
11 _ => fib_classic_recursive(n - 1) + fib_classic_recursive(n - 2),
12 }
13}
14
15thread_local!(static MEMO: RefCell<Vec<usize>> = RefCell::new(vec![0; 1000]));
16

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected