Solving a Fibonacci like recurrence in log n time

前端 未结 2 798
星月不相逢
星月不相逢 2021-01-12 01:57

Finding the nth term in Fibonacci series f(n) = f(n-1) + f(n-2) can be solved in O(n) time by memoization.

A more efficient way would be to find the nth power of mat

2条回答
  •  北海茫月
    2021-01-12 02:08

    You may want to look into Tribonacci numbers (and other generalizations of Fiboniacci numbers.) They have been studied quite extensively. See e.g. Generalizations of Fibonacci numbers

提交回复
热议问题