Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

solve all part,thanks Laila loves food. However, she is currently on a diet. The nutrition specialist put her on a special diet in which she

image text in transcribedimage text in transcribedsolve all part,thanks

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. I 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. 1 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

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_2

Step: 3

blur-text-image_3

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 And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 2 Lncs 13427

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124251, 978-3031124259

More Books

Students also viewed these Databases questions