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

Function fib_cache_result_c

cpp/fib.c:5–12  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3int MEMO[100] = { 0 };
4
5size_t fib_cache_result_c(size_t n)
6{
7 if (0 == n) return 0;
8 if (1 == n || 2 == n) return 1;
9 if (0 != MEMO[n]) return MEMO[n];
10 MEMO[n] = fib_cache_result_c(n - 1) + fib_cache_result_c(n - 2);
11 return MEMO[n];
12}
13
14size_t fib_classic_iteration_for_c(size_t n)
15{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected