Suppose you are organizing a party for a large group of your friends. Your frien
ID: 3775680 • Letter: S
Question
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 1 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.
Explanation / Answer
We use will be using G(v,e,w) as the social graph, G.adjoing(me) as the sub-graph of my friends networ and Moreover will be using(z1,z2) as the familiar weight of z1 and z2. we can choose the friends in the following ways.The total number of friends is n: Friendset is first empty and I will put me in the Firstset. while(|Friendset|denotes the number of friends may not be maximum as this is less than n which is the total number of friends invited.Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.