This exercise deals with "Fibonacci trees", trees that represents the recursive call structure of the Fibonacci computation. (The Fibonacci sequence is defined as follows: F0 = 0, F1 = 1, and each subsequent number in the sequence is the sum of the previous two.)
The root of a Fibonacci tree should contain the value of the
n
th Fibonacci number the left subtree should be the tree representing the computation of the n1
st Fibonacci number, and the right subtree should be the tree representing the computation of the n2
nd Fibonacci number. The first few Fibonacci trees appear below.Function  Graph 
fibtree(0) 

fibtree(1) 

fibtree(2) 

fibtree(3) 

fibtree(4) 

fibtree(5) 
Supply the
fibTreeHelper
method to go with the BinaryTree
method below.
public static BinaryTree fibTree (int n) {
BinaryTree result = new BinaryTree();
result.myRoot = result.fibTreeHelper (n);
return result;
}
private TreeNode fibTreeHelper (int n) ...
Note: Primitive types like
int
are not objects. Java provides wrapper classes that allow primitive values to be stored as objects. In some situations, Java will automatically convert one to the other. This is called autoboxing and autounboxing.