Suppose you and your friend Alanis live, together with n − 2 other people, at a popular off-campus cooperative apartment, the Upson Collective. Over the next n nights, each of you is supposed to cook dinner for the co-op exactly once, so that someone cooks on each of the nights. Of course, everyone has scheduling conflicts with some of the nights (e.g., exams, concerts, etc.), so deciding who should cook on which night becomes a tricky task. For concreteness, let’s label the people {p1, . . . , pn},the nights {d1, . . . , dn}; and for person pi, there’s a set of nights Si⊂ {d1, . . . , dn}when they are not able to cook. A feasible dinner schedule is an assignment of each person in the coop to a different night, so that each person cooks on exactly one night, there is someone cooking on each night, and if picooks on night dj, then dj∈ Si. (a) Describe a bipartite graph G so that G has a perfect matching if and only if there is a feasible dinner schedule for the co-op. (b) Your friend Alanis takes on the task of trying to construct a feasible dinner schedule. After great effort, she constructs what she claims is a feasible schedule and then heads off to class for the day. Unfortunately, when you look at the schedule she created, you notice a big problem. n − 2 of the people at the co-op are assigned to different nights on which they are available: no problem there. But for the other two people, pi and pj, and the other two days, dk and dl, you discover that she has accidentally assigned both pi and pj to cook on night dk, and assigned no one to cook on night dl. You want to fix Alanis’s mistake but without having to recompute everything from scratch. Show that it’s possible, using her “almost correct” schedule, to decide in only O(n2) time whether there exists a feasible dinner schedule for the co-op. (If one exists, you should also output it)
a)
It is given that there are n people and n nights. Thus, it
is required to assign each person pto a night such
that p available to cook on night d,
By observing, we can conclude that, assigning persons
to available nights to cook is a matching problem.
Particularly, since it is required to assign a person to
only one night, the assignment should be a perfect
matching
We can find this perfect matching as follows:
First, build a bipartite graph. Take two sets of vertices.
One is the set of people. (p.p2 Poland another is
the set of nights,(d.djd).
• Now add an edge (p, d) to bipartite graph if the
person p, is available to cook on night d
• To find whether there is a perfect matching or not, we
can use maximum flow algorithm
· Add two more vertices, source vertex(s and sink
vertex to bipartite graph. Add edges from sto each
person. Also, add edges from each night to t
• Set each edge's capacity to 1
• Now, run the maximum flow algorithm. The schedule
will be feasible, if and only if the maximum flow is n
and the graph has exactly n edges (perfect matching).
If there is a maximum flow with value n and graph has
exactly edges, each person will be joined to a
distinct night. Thus, the matching gives the feasible
dinner schedule.
If there is no such maximum flow, there will be no
feasible dinner schedule.
b)
It is given that p and p both are assigned to dh and no one is
assigned to cook on night di
• If there exists a feasible schedule, then there is a possibility
that either
di S, and die For)
di S. and Scor)
die Sandd ES (or)
dieS and dies
• If du Sand dies then it is enough to add edge ( Pd). Otherwise
we need find an edge
Pr. dr) to assign py to either dord and need to assign either and
pto de
Algorithm FIX SCHEDULE
DeSi and S, then
2) Update edges in the graph (p. d) and ( d) and exit the
loop
Il print the schedule
3)
for each edge (pad)
4)
print (p is assigned to night)
5) return !
1 indicates that there exists a feasible dinner schedule
6) Flag-False
7) Flag False
8) If doES, theu
9) for each edge (p. d)
10)
If die Saud de Sithen
Update edges in the graph (p. d) and (peda)
12)
Flag=Tie
13)
exit the loop
14) che
15) Flagl-True
16) If d eS, then
17) for each edged )
18)
If di Sg and d e S, then
19)
Update edges in the graph (pd) and ipod
20)
Flag2-True
21)
exit the loop
22) else
23) Flag2-Tnue
/if both flags are true, then there exists a feasible dinner
schedule
24) If Flac=True and Flag=True then
l print the schedule
25) for each other (
pd.)
26)
print (p is assigned to cook night di
27 return 1 indicates that there exists a feasible dinner
schedule
28) else
29)
return O
I/O indicates that there exists no feasible dinner schedule
Running time analysis:
• Consider the code fragment from lines 8 to 15 and code fragment
from lines 16 to 23
• Both fragments take same ninning time.
• Consider the for loop at line 9, which takes O(n), since in the
feasible dinner schedule,
there will be only edges.
. Consider the code at line 10. In the worst case, checking
membership of as set takes On).
• Thus, the overall running time of the code fragment is O ).
Therefore, we can check whether there exists feasible dinner
schedule or not in O(n) time.
Suppose you and your friend Alanis live, together with n − 2 other people, at a...
Please show your work. Thx! 2. Suppose you and your friend live on the same street D miles away from each other. Between your house and your friend's house there are n motorized scooters positioned at distances Ti, 32,... , x,n miles from your house towards your friend's house. Each scooter has a battery that may or may not be fully charged. Let's say that the scooters can take you distances di, d2,... , dn miles down the road Any...
2. Suppose you and your friend live on the same street D miles away from each other. Between your house and your friend's house there are n motorized scooters positioned at distances Ti, 32,... , x,n miles from your house towards your friend's house. Each scooter has a battery that may or may not be fully charged. Let's say that the scooters can take you distances di, d2,... , dn miles down the road Any time you encounter another scooter,...
please solve 22.1, using the Theorem given. Thank you. Theorem 22.1. Suppose that n people (n 2 2) are at a party. Then there exist at least two people at the party who know the same number of people present First you need to know the rules. We will assume that no one knows him- or herself. We will also assume that if x claims to know y, then y also knows x. The idea behind the proof is this,...
Age: 27 years old Subjective information: Ms. Lyon comes to see you because she is worried about her weight and future health issues that may arise due to excess weight on her body. She reports having had weight issues since she was a child. Ms. Lyon states there is history of Type II Diabetes on her mother's side and history of hypertension and stroke on her father's side of the family, and she is worried about the connection between excess...
After reading the article, answer the questions that follow. Turning Off, Dining In Last night at dinner, I suddenly realized that no one around our table had said anything for quite a while. I looked at my son, who had headphones on and whose face was aglow with the white-blue light of this phone on which he was watching a YouTube video. My daughter was also bathed in this same glow, but a tap-tap-tap was coming from her phone as...
[300-500 words] Read the interview transcripts with Herb Kelleher (Southwest Airline) below and answer the following questions. 1) How would you analyze Herb Kelleher’s personality and motivation? Use at least twoconcepts for each from class discussions in personalities and motivation, and explain what (which part of the transcripts) makes you think so. Also, discuss how such personality would contribute to the success of Southwest Airline. 2) When it comes to negotiations between Southwest Airline and Boeing, who (whichcompany) is Southwest...
Interpersonal Communication Subject! Advice Column Assignment - Guidelines If you’ve perused a newspaper before, you’re probably familiar with the various advice columnists (“Dear Abby” comes to mind) who help out distraught individuals in managing any number of interpersonal crises in his/her life. This assignment is divided into two parts: One where you'll be assuming the role of the letter writer who presents the problem, and another where you'll play the role of the actual advice columnist and respond to letters....
[300-500 words] Read the interview transcripts with Herb Kelleher (Southwest Airline) below and answer the following questions. 1) How would you analyze Herb Kelleher’s personality and motivation? Use at least twoconcepts for each from class discussions in personalities and motivation, and explain what (which part of the transcripts) makes you think so. Also, discuss how such personality would contribute to the success of Southwest Airline. 2) When it comes to negotiations between Southwest Airline and Boeing, who (whichcompany) is Southwest...
Tony and Peggy Sue graduated from a university in Texas last May. She received a degree in elementary education, and he graduated from the culinary school. They both now work in the Dallas area. Peggy Sue is a teacher, and Tony is a chef at a resort hotel restaurant. It is Christmas Day and Tony asks Peggy Sue to marry him. She excitedly accepts. They set a wedding date of June 30. Tony is from New York City. He is...
After reading the Rowe article (ROWE, M. THE BEST DAM RESTAURANT, Period!. Restaurant Hospitality. 95, 6, 28-32, June 2011. ISSN: 01479989), what does the article contribute to this owner being proud to call her restaurant America’s Best Dam Restaurant? The Best Dam Restaurant, Period! Megan Rowe | Aug 01, 2010 You know a place is good when guests — many of them chefs-are willing to endure a wait for a table in the wee hours. That's the kind of following...