HeIp understanding Fibonacci Search

On the internet I only find code for the algorithm but I need understand in form of text first because I have trouble understand things from code only. And other description of the algorithm are very complicated for me (on Wikipedia and other sites)....
more »

2017-09-03 17:09 (1) Answers

Recursive Fibonacci in Ruby

This week is my first time doing recursion. One of the problems I was able to solve was Fibonacci's sequence to the nth number; it wasn't hard after messing with it for 5 minutes. However, I am having trouble understanding why this works with the c...
more »

2017-07-08 02:07 (3) Answers

Variable assignment query in python

I am writing Fibonacci code in python. The below solution is mine. While the other below solution is from python.org. Can anyone tell me why it yields a different answer even though the logic of assigning the variables is the same? ...
more »

2017-06-26 20:06 (4) Answers

How to fix aborting Fibonacci sequence code

I am trying to get a Fibonacci sequence of 5 million elements. This code aborts abnormally, when I pass 1000 as a parameter. def self.fibo_seq(limit) result_array = [0,1] return result_array if limit < 2 while result_array.length <= l...
more »

2017-03-15 19:03 (4) Answers

How this Fibonacci code(Ruby) works?

I understood how the formula for Fibonacci works but not the recursion part. For example, fib(4) will call for fib(3) + fib(2), then what? How does the method determines the value of fib(3) and fib(2)? I am a beginner in Ruby so please excuse me for ...
more »

2016-11-25 10:11 (2) Answers

Sum of Fibonacci even number

I'm currently working on small ruby projects from project Euler site. I was given a task to sum even fibonacci numbers that are less than 4 millions. Unfortunately there is a small bug in my code, because when I change the limit e.i. to 100, it print...
more »

2016-06-12 23:06 (1) Answers