Question
Problem Python programming language and compare the efficiency of those in terms of the number of recursive calls made or a number of iterations for
Problem Python programming language and compare the efficiency of those in terms of the number of recursive calls made or a number of iterations for the pseudo algorithm 3.
Your implement should follow the pseudocode provided in the textbook/lecture and use sample prices with pi dollars of revenue for the length i in the table below for testing, then you can define pi dollars for lengths.
length i | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
price pi | 1 | 5 | 8 | 9 | 10 | 17 | 17 | 20 | 24 | 30 |
For this set you need to give code for 3 type of algorithm Recursive top-down implementation, Recursive top-down implementation with memoization, Recursive bottom-up implementation with memorization
2. Test your implementations:
a. A user will enter a number for n, the size of the rod.
b. For each of the algorithms, determine the optimal revenue rn (n = 1..10) and display the revenue. For the bottom-up implementation, also determine a choice that led to the optimal value, and display the best decompositions of the n.
c. For each of the algorithms, count a total number of recursive calls or iterations when determining rn and display/compare them.
d. Repeat a-c at least 5 times and show the results.
e. find the running time of real code (code for all three case)
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