Greedy algorithm for the following -
i trying solve following problem using greedy algorithm,
we have n
friends , want give present each 1 of them. don't want give same present 2 person know each other. (if x knows y, y knows x). people not know each other may take same gift, okay. want minimize number of distinct gifts given.
here thought, try make pairs of people not know each other, , give them same gift. not sure whether greedy algorithm. also, may want find maximum group of people in no 1 knows other, can give hem same gift. can this? can find maximum group of people not know each other?
can propose greedy algorithm problem?
the problem have mentioned restatement of graph coloring
problem. have label graph’s vertices colors such no 2 vertices sharing same edge have same color. link given below greedy coloring algorithm
.
Comments
Post a Comment