Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( Optional for 2 % extra credit: An algorithm with logarithmic efficiency ) Now we want to get better efficiency for the Fibonacci numbers. A
Optional for extra credit: An algorithm with logarithmic efficiency
Now we want to get better efficiency for the Fibonacci numbers. A new property
is needed to achieve this goal. From our textbook, we have the following matrix
formula,
for
In order to apply this formula, you need to know how to calculate the matrix
multiplication. To calculate the powers of a matrix as fast as possible, we can
use the repeated squaring technique. We still use the Java BigInteger class to do
calculation for this part. If you use Python, it can handle big integers automatically
without any special treatment.
You still pass the problem size as before. If is not provided, use the default
value
For each of your programmethod write appropriate messages for the users to under
stand what you are doing.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started