Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(10 points) A group of n dancers will be performing while while holding flags. It's optimal if each dancer is holding a flag as
(10 points) A group of n dancers will be performing while while holding flags. It's optimal if each dancer is holding a flag as close as possible to their height. You have a collection of n flags of varying lengths and you want to assign a flag to each dancer such that you are minimizing the total difference in heights. That is minimizing i=1 Id; - fil where d; is height of a dancer and f; is height of flag. Consider the following two strategies and prove or disprove that they work. 1. (5 points) Greedly, pick the dancer and flag that have the minimum difference in height. 2. (5 points) Sort the two lists and then assign the ith dancer to the ith flag. Does this algorithm work? If it doesn't, show a counter example.
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