Question: Write a functionfibPowthat takes a natural numbern, and returns(Ln(0,1))1.(a) First choose a representation forL. (HINT: The variableLis used because the function is a linear operator.Functional

Write a functionfibPowthat takes a natural numbern, and returns(Ln(0,1))1.(a) First choose a representation forL. (HINT: The variableLis used because the function is a linear operator.Functional programmers beware!)(b) Then implement an algorithm to raise objects of that type to thenth power that requires onlyO(log(n))iterations.(c) Finally, implementfibPowusing the representation ofLand the power algorithm.(d) What is the asymptotic time complexity offibPow?
4. (project) Write a function fibPow that takes a natural number n, and returns (L"(0,1))1. (a) First choose a representation for L. (Hint: The variable L is used because the function is a linear operator. Functional programmers beware!) (b) Then implement an algorithm to raise objects of that type to the nth power that requires only O(log(n)) "iterations." (c) Finally, implement fibow using the representation of L and the power algorithm. (d) What is the asymptotic time complexity of fibPow? 4. (project) Write a function fibPow that takes a natural number n, and returns (L"(0,1))1. (a) First choose a representation for L. (Hint: The variable L is used because the function is a linear operator. Functional programmers beware!) (b) Then implement an algorithm to raise objects of that type to the nth power that requires only O(log(n)) "iterations." (c) Finally, implement fibow using the representation of L and the power algorithm. (d) What is the asymptotic time complexity of fibPow
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
