I need some help with a program I\'m writing for my Programming II class at universtiy. The question asks that one calculates the Fibonacci sequence using recursion. One mus
I believe you forget to actually look up stuff in your dictionary.
Change
else return dictionary[n] = fibonacci(n-1) + fibonacci(n-2);
to
else { if (dictionary[n] > 0) return dictionary[n]; return dictionary[n] = fibonacci(n - 1) + fibonacci(n - 2); }
and it works just fine (tested it myself :)