Question

Suppose you are organizing a party for a large group of your friends. Your friends are...

Suppose you are organizing a party for a large group of your friends. Your friends are pretty opinionated, though, and you don’t want to invite two friends if they don’t like each other. So you have asked each of your friends to give you an “enemies” list, which identifies all the other people among your friends that they dislike and for whom they know the feeling is mutual. Your goal is to invite the largest set of friends possible such that no pair of invited friends dislike each other. To solve this problem quickly, one of your relatives (who is not one of your friends) has offered a simple greedy strategy, where you would repeatedly invite the person with the fewest number of enemies from among your friends who is not an enemy of someone you have already invited, until there is no one left who can be invited. Show that your relative’s greedy algorithm may not always result in the maximum number of friends being invited to your party.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Relative’s greedy algorithm is not optimal.

This can be proved by the following example.

Let the friends to be invited are Ali, Bill, David, Dennis, Grace, Eemi, and Sam.

The enemy list of each friend is shown below:

•    Ali: Bill. David, Dennis

•    Bill: Ali, Grace, Eemi, Sam

•    David: Ali, Grace, Eemi, Sam

•    Dennis: Ali, Grace, Eemi, Sam

•    Grace: Bill. David, Dennis. Eemi . Sam

•    Eemi: Bill, David, Dennis, Grace, Sam

•    Sam: Bill, David, Dennis, Eemi, Grace

Here the one with fewer enemies is Ali.

If we invite Ali, then Bill, David, and Dennis cannot be invited.

Next person that can be invited is one from Grace, Eemi, and Sam

If we choose any one of them we cannot add any other person.

For example, if we choose Grace, all other members are enemies of Ali and Grace. So only Ali

and Grace can only be invited.

So we get a list of two members using relative’s greedy algorithm.

This is not the optimal solution.

The optimal solution is a list of 3 members

•    Bill, David, and Dennis can be invited to the party.

Hence proved that relative’s greedy algorithm is not optimal, where the maximum number of friends is not invited to the party.

Add a comment
Know the answer?
Add Answer to:
Suppose you are organizing a party for a large group of your friends. Your friends are...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT