Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

(a) Show that n is o(nlogn)

Answered: 1 week ago