|
|
|
|
|
by wapz
3348 days ago
|
|
I was recently asked to calculate the fibonacci sequence value in an O(log n) time complexity. I had no clue how to do it and explained that I can solve it in O(N) easily but don't even know how to approach the O(log n) method. I knew there must be some trick using factors but didn't even know how to start the problem. I looked it up later and one of the ways is using matrix multiplication (an implementation I still wouldn't be able to do without seeing pseudocode). |
|
http://mathworld.wolfram.com/BinetsFibonacciNumberFormula.ht...