Question
. Every semester you take a set of courses among the remaining courses in your program of study. Suppose that for each remaining course i,
. Every semester you take a set of courses among the remaining courses in your program of study. Suppose that for each remaining course i, ci and vi indicate its number of credits and how valuable the course is to your learning goals, respectively. Also, assume that your university only allows you to take up to the total of M credits each semester.
(a) Using dynamic programming, write a recursive top-down (with memorization) algorithm BestValuePlan(c, v, n, M) that returns maximum total value of courses that you can choose for a semester among the n remaining courses. c and v are arrays of credits and values, respectively. You can define and use auxiliary functions as needed.
(b) Write a bottom-up (non-recursive) algorithm for the same solution.
(c) Extend the algorithm in the previous step to print the actual solution (set of courses).
(d) Draw the subproblem graph for your solution, and analyze its time complexity accordingly.
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