# Fibonacci Functions and Sets (+Java)

• Oct 29th 2012, 12:06 PM
hcs0112358
Fibonacci Functions and Sets (+Java)
I would like some help getting through these 2 problems:

Implement all three methods we discussed for computing a given element F_n the Fibonacci sequence: F_0 = F_1 = 1. F_k = F_k-1 + F_k-2 for k > 1.
1. Recursive (write a recursive function to compute F_n given input n)
2. Inductive (compute F_0, …, F_n in order)
3. Formula (compute F_n directly using the formula we derived, also on pg. 323)
Compare each of these methods on a range of n values. What do you conclude? Which method is fastest, uses the least memory, easiest to implement?

Implement your own Set class in Java for storing sets of integers (note: Java has a built-in set class, but you should not use it). Your class should support the following basic set operations: union, intersection, difference. Demonstrate your class works on some example operations and discuss how efficient your implementation is.
• Oct 29th 2012, 01:30 PM
a tutor
Re: Fibonacci Functions and Sets (+Java)
What have you done so far?