Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in Java or C++ with an illustration by drawing the divid and conker and the table for it + the code is unique, just

image text in transcribed

image text in transcribed

Code in Java or C++ with an illustration by drawing the divid and conker and the table for it + the code is unique, just what I do, it prints 25 correct, with the same example as in the home

Code in Java or C++ with an illustration by drawing the divid and conker and the table for it + the code is unique, just what I do, it prints 25 correct, with the same example as in the home

Dynamic Programming Project (Fall 2022/2023) Laila's Food Diet Laila loves food. However, she is currently on a diet. The nutrition specialist put her on a special diet in which she eats only one meal per day! Her meal must belong to one of the following three types: (i) Carbohydrates. (ii) Protein and (iii) V\&A (Vitamins and Minerals). Whenever she eats a certain meal she gains a certain amount of calories. Different meals result in different calories depending on the day and depending on the type. For example when eating meal no. 1 in the Carbohydrates type, Laila gains a different amount of calories compared to eating meal no. 1 in the Protein type. Also when eating meal no. l in the Carbohydrates type, Laila gains a different amount of calories compared to meal no. 2 or meal no. 3 from the Carbohydrates category and so on. The diet is designed to last N days (from day 1 to day N ). Each day Laila can choose any meal she likes from any of the 3 types, however, she is not allowed to select two meals of the same type in two consecutive days. Also, if Laila selects a certain meal, she is not allowed to select the same meal again. Find the minimum amount of calories needed by Laila to finish the N days of the diet. Here is a reminder of the outline of your solution: Part1: Divide \& Conquer 1- Define the value returned by the function f which we want to optimize. 2- Define the parameters which f depends on. 3- Draw the recursion tree for f using the values from the example above. 4- Write the recursive (divide and conquer) code to solve the question. Part2: Dvnamic Programming 5- Draw the table and determine the dependencies between the table cells. 6- Determine the direction of movement within the table. 7- Write the Dynamic programming code which fills the table(s). 8- Write the code that will print the sequence of moves that go you the solution. You are requested to submit a report that explains each of the steps above which also includes graphs and figures to explain your solution and the rationale behind it. Also, you need to submit your working code on the hackerrank website as usual. The link will be provided on Moodle/FB Group. Important: To solve this task you are not allowed to copy/be inspired by any piece of code from the internet or from a colleague or from anyone or any place. If any percentage of resemblance is found between your code and a code listed on the internet (even if the code is a solution for a different problem), it will be considered cheating. You are only allowed to check the code of the three problems we studied at class and the last years problems I posted on Moodle. If it has been proven that you cheated on this task (no matter how small the percentage is), you will get zero in the final exam mark

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

More Books

Students also viewed these Databases questions

Question

What are some of the important outcomes of job satisfaction?

Answered: 1 week ago