Question: Explain why your code works, and give some examples of the answers it gives for various inputs, including large values.(java) 1. (10 points) You have
1. (10 points) You have probably heard of the Fibonacci sequence, where each number in the sequence is the sum of the previous two numbers. Your professor has recently developed the extended Fibonacci sequence, where each number in the sequence is the sum of the previous three numbers. The base cases are efibonacci(1)=1, efibonacci(2)=1, efibonacci(3)=1. Give a correct recursive (no loops or arrays) Java function that computes the new extended Fibonacci sequence for any integer n. THINK ABOUT NON- POSITIVE INPUTS; non-positive inputs should continuethe sequence. An example of the input (starting from one) and output of this function is: efibonacci(1) = 1 efibonacci(2) = 1 efibonacci(3) = efibonacci(4) = efibonacci(5) = 5 efibonacci(6) = 9 efibonacci(7) = 17
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
