Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
159 views

Can I optimize my implementation of generating Fibonacci series using recursion?

My function accepts a number, which generates total Fibonacci numbers. I am using recursion. Please follow the code below, ...
Rahul Shivsharan's user avatar
6 votes
2 answers
1k views

C++17 Recursive Fibonacci calculation with memoization

Compiler is g++ 4.2. I'm new to C++, but I've done a lot of data science, web scraping, and some socketing stuff in Python. This code generates the nth Fibonacci number, either with a naive ...
William Bradley's user avatar
3 votes
1 answer
186 views

Fibonacci Sequence using Recursion with Memoisation

File fibonacci.aec: ...
FlatAssembler's user avatar
4 votes
2 answers
1k views

Recursive vs. non-recursive implementations of Fibonacci sequence

I have 2 functions to get the n-th fibonacci number. The 1st one uses recursive calls to calculate the power(M, n), while the 2nd function uses iterative approach for power(M, n). Theoretically (at ...
NepNep's user avatar
  • 301
0 votes
1 answer
109 views

Fibonnaci sequence calculation [closed]

Below are two ways to calculate an element of the Fibonacci series. Can someone please help me understand why fib1 is so much faster (over 60x) than ...
psyco's user avatar
  • 3
0 votes
2 answers
1k views

Fibonacci Nth term using tail recursion [closed]

I have created a program that prints the Nth term of the Fibonacci sequence. The fib function needs to use tail recursion. If what I have coded isn't tail recursion, I would like to know how to change ...
user avatar
12 votes
2 answers
4k views

Recursive Fibonacci in Rust with memoization

I'm trying to come up with an "elegant" way of calculating Fibonacci for number in Rust, using recursion and memoization (self-imposed requirements). This is what I have so far: ...
Armando Pérez Marqués's user avatar
1 vote
1 answer
470 views

Recursive Fibonacci in Java

I just started learning recursion and memoization, so I decided to give a simple implementation a shot. Works with some simple test cases I came up with. Is there anything I can add to make this more ...
Togepi's user avatar
  • 127
1 vote
4 answers
2k views

Improving Fibonacci recursion with BigIntegers

I've been tasked with making a fast Fibonacci recursive method that uses BigInteger to calculate REALLY big numbers. However, to calculate numbers past 30 it takes ...
Ozymandias's user avatar
8 votes
1 answer
2k views

Fibonacci in linear time by using an extra pointer

I have a function to find the nth number in a Fibonacci sequence, in which I am recursively calling the function. The sum is stored in a class variable and I have an extra pointer I increment every ...
paddy's user avatar
  • 83
12 votes
6 answers
4k views

Python 3 - Fibonacci Implementation

I wrote a function returning the n-th Fibonacci number in Python 3: ...
user7802048's user avatar
3 votes
2 answers
642 views

Finding the nth Fibonacci number using recursive technique

EDIT So I've been working on this according to the challenge @PeterTaylor gave me. I'm not very good at math, so I've been doing a lot of reading and found this link on the Binet form. Fibonacci ...
Nathan's user avatar
  • 175
12 votes
2 answers
5k views

Lovely Lucky LAMBs

I am trying to solve this question from google's foobar. However, my code exceeds the time limit, even though when I tested it I got correct answers. How can I make my code more efficient? Lovely ...
ngmh's user avatar
  • 123
5 votes
5 answers
7k views

Finding large Fibonacci Number in Python

I'm doing Project Euler at 1000-digit Fibonacci number - Problem 25 which says The Fibonacci sequence is defined by the recurrence relation: Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. ...
user avatar
13 votes
5 answers
5k views

Simple Fibonacci using recursion

The sole purpose of this post is to see how a production quality developer would approach this very simple problem. I am a fresh graduate and do not have a professional development experience. What ...
sophist_pt's user avatar

15 30 50 per page