News for hackers. Stuff that matters.
Re:Data structures and algorithms I actually used while work... by WJW on Wednesday July 15, 2020 @07:31AM (#23843746)
There should be a fourth level where they use the closed form solution to get to the solution they want without any recursion or looping for reasonable values of N. Maybe even a fifth level using the O(log(N)) matrix exponentiation method.
Re:Data structures and algorithms I actually used while work... by sk5t on Wednesday July 15, 2020 @08:17AM (#23844107)
I’m a bit puzzled at the idea of using recursion for an infinite sequence (did OP mean factorial?). Give me a LazyList / generator / IEnumerable instead any day for Fib.