fib_memoized computes the nth fibonacci number (1-indexed)

fib_memoized(n, newlist)

Arguments

n

an integer

newlist

createList(n)

Value

the nth fibonacci number

Details

This function uses memoization and is more efficient than fib

Examples

fib_memoized(10,createList(10))[[1]]
#> [1] 55