Question: Problem 4. (25 points) Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at

Problem 4. (25 points) Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor g;, which is the minimum size of a cookie that the child will be content with; and each cookie j has a size sj . If s, 2 9i, we can assign the cookie j to the child i, and the child i will be content. Your goal is to maximize the number of your content children and output the maximum number. Describe an efficient greedy algorithm for the same. Note: You may assume the greed factor is always positive. Also you cannot assign more than one cookie to a child
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
