Write the Java source code necessary to build a solution for the problem below: The Fibonacci numbers
Question:
Write the Java source code necessary to build a solution for the problem below: The Fibonacci numbers form a sequence where each number is the sum of the previous two numbers. Starting from 0 and 1, the first eight Fibonacci numbers are built in the following list using the equation Fn = Fn-1 + Fn-2: 0, 0 0, 1 1, 1 1, 2 2, 3 3, 5 5, 8 8, 13 The sequence would be the numbers in red (0, 1, 1, 2, 3, 5, 8, 13). Using a linked list ,create a stack class and a test program to display the first 50 Fibonacci numbers in descending order. Use a stack to store these numbers. Once 50 numbers have been computed, print the numbers in a descending order. You will note that this process is naturally recursive. Therefore, use recursion to find this series of Fibonacci numbers..
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang