SlideShare a Scribd company logo
1 of 2
Download to read offline
For part B use BFS and with another loop. There is a group of p Ava DuVernay fans (or ADFs
for short) who have booked an entire movie theater for a screening of A Wrinkle in Time . Out of
the p(p1)/2 possible pairs, f pairs of ADFs are friends. The movie theater is called the Square
Theater and has p rows with each row having exactly p chairs in them. (If it helps, you can
assume that the p2 chairs are arranged in a "grid" / "matrix" form where each of the p rows has p
chairs each and each of the p columns has p chairs each.) The ADF organization committee has
come to you to help them efficiently solve the following seating problem for them. Informally,
you want to seat the ADFs so that friends can talk to each other (and "distant" friends remain
distant). Next, we make this informal description more formal. A seating (as you might expect) is
an assignment of the p ADFs to the p2 chairs in the theater so that each ADF gets his/her own
chair. A seating is called admissible if 1. for every pair of friends (b1,b2), they can talk to each
other during the movies 2. some ADF is assigned a seat in the first row and 3. the seating
satisfies the distance compatible property. The ADFs have been to the Square theater before so
they have figured out that two people can talk to each other if and only if they are either - seated
in the same row or - are seated in the rows next to them (i.e. either to the row directly in front or
the row directly behind. The first and the last row of course only have one row next to them). A
seating has the distance compatible property if and only if the following holds. For any b1 who is
assigned a seat in the first row and any ADF b2, if b1 and b2 have a friendship distance of d
(assuming d is defined), then they have to be seated d or more rows apart. (The friendship
distance is the natural definition. Let a friendship path between b1 and b2 be the sequence of
ADFs f0=b1,f1,,fk1,fk=b2 (for some k0 ) such that for every 0ik1,(fi,fi+1) are friends-- the
length of such a path is k. The friendship distance between b1 and b2 is the shortest length of any
friendship path between them. So if b1 is b2 's friend, they have a friendship distance of 1 and if
b2 is a friend of a friend, they have a distance of 2 and so on. The friendship distance is not
defined if there is no friendship path between b1 and b2.) Note Note that the above property is
not defined for all pairs of ADFs b1 and b2. (Indeed the problem you will be asked to solve is
impossible if the distance compatible property has to hold for all pairs.) Note that the above is
defined for only those b1 who are seated in the first row (and every possible b2 ). As an example
consider the case of p=3 and f=2 as follows. The ADFs are A,B,C and the (A,B) and (B,C) are
the pairs of friends. Then an admissible seating is to assign the "left-most" seat on first row to A,
the left-most seat in second row to B and the left-most seat on the third row to C. This following
is also an admissible seating: B is assigned (any seat) in the first row while A and C are assigned
any two seats in the second row. Your final task is to design an O(f+p2) time algorithm that
computes an admissible seating, given as input the set of p ADFs and the set of f pairs of ADFs
who are friends. Here are the two parts:
(a): Formalize the problem above in terms of graphs: i.e. write down i. How you would represent
the input as a graph G; ii. How you would define a seating and iii. Define what it means for a
seating to be admissible in terms of properties of graph G. (b) Using part 1 or otherwise design
an O(f+p2) time algorithm to compute an admissible seating. (Recall that your algorithm should
work for any set of p eople and any possible set of f friendships.) You should prove the
correctness of your algorithm. You also need justify the running time of your algorithm.

More Related Content

More from fmac5

Hello please help me how to do this project in C and explain to me h.pdf
Hello please help me how to do this project in C and explain to me h.pdfHello please help me how to do this project in C and explain to me h.pdf
Hello please help me how to do this project in C and explain to me h.pdf
fmac5
 
Gordon and Colleen Howe� Mini CaseToday is January 1, 2023.pdf
Gordon and Colleen Howe� Mini CaseToday is January 1, 2023.pdfGordon and Colleen Howe� Mini CaseToday is January 1, 2023.pdf
Gordon and Colleen Howe� Mini CaseToday is January 1, 2023.pdf
fmac5
 
Go to Previous section To Partner or Not to Partner with a Retail Co.pdf
Go to Previous section To Partner or Not to Partner with a Retail Co.pdfGo to Previous section To Partner or Not to Partner with a Retail Co.pdf
Go to Previous section To Partner or Not to Partner with a Retail Co.pdf
fmac5
 

More from fmac5 (13)

hello with only using the properties from the right hand side can yo.pdf
hello with only using the properties from the right hand side can yo.pdfhello with only using the properties from the right hand side can yo.pdf
hello with only using the properties from the right hand side can yo.pdf
 
Hello please help me how to do this project in C and explain to me h.pdf
Hello please help me how to do this project in C and explain to me h.pdfHello please help me how to do this project in C and explain to me h.pdf
Hello please help me how to do this project in C and explain to me h.pdf
 
Greenwich Industries entered the Latin American market in the 1950s .pdf
Greenwich Industries entered the Latin American market in the 1950s .pdfGreenwich Industries entered the Latin American market in the 1950s .pdf
Greenwich Industries entered the Latin American market in the 1950s .pdf
 
Gordon and Colleen Howe� Mini CaseToday is January 1, 2023.pdf
Gordon and Colleen Howe� Mini CaseToday is January 1, 2023.pdfGordon and Colleen Howe� Mini CaseToday is January 1, 2023.pdf
Gordon and Colleen Howe� Mini CaseToday is January 1, 2023.pdf
 
Go to Previous section To Partner or Not to Partner with a Retail Co.pdf
Go to Previous section To Partner or Not to Partner with a Retail Co.pdfGo to Previous section To Partner or Not to Partner with a Retail Co.pdf
Go to Previous section To Partner or Not to Partner with a Retail Co.pdf
 
Given the following list of accounts with normal balance, prepare a .pdf
Given the following list of accounts with normal balance, prepare a .pdfGiven the following list of accounts with normal balance, prepare a .pdf
Given the following list of accounts with normal balance, prepare a .pdf
 
Given the following challenges, use append(), extend(), pop(), and i.pdf
Given the following challenges, use append(), extend(), pop(), and i.pdfGiven the following challenges, use append(), extend(), pop(), and i.pdf
Given the following challenges, use append(), extend(), pop(), and i.pdf
 
Given Microsoft�s lackluster performance since 2000, the once domina.pdf
Given Microsoft�s lackluster performance since 2000, the once domina.pdfGiven Microsoft�s lackluster performance since 2000, the once domina.pdf
Given Microsoft�s lackluster performance since 2000, the once domina.pdf
 
Given an array of ints, return true if the number of 1s is greate.pdf
Given an array of ints, return true if the number of 1s is greate.pdfGiven an array of ints, return true if the number of 1s is greate.pdf
Given an array of ints, return true if the number of 1s is greate.pdf
 
give me an example of 6. Additional Plans Specify or re.pdf
give me an example of 6. Additional Plans Specify or re.pdfgive me an example of 6. Additional Plans Specify or re.pdf
give me an example of 6. Additional Plans Specify or re.pdf
 
Give me a substantive comment on this postThe way an organization.pdf
Give me a substantive comment on this postThe way an organization.pdfGive me a substantive comment on this postThe way an organization.pdf
Give me a substantive comment on this postThe way an organization.pdf
 
Give an extensive background of Pick n Pay. This should include info.pdf
Give an extensive background of Pick n Pay. This should include info.pdfGive an extensive background of Pick n Pay. This should include info.pdf
Give an extensive background of Pick n Pay. This should include info.pdf
 
Geoffrey This is very helpful, but I need your guidance to s.pdf
Geoffrey This is very helpful, but I need your guidance to s.pdfGeoffrey This is very helpful, but I need your guidance to s.pdf
Geoffrey This is very helpful, but I need your guidance to s.pdf
 

Recently uploaded

MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
Krashi Coaching
 

Recently uploaded (20)

Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
 
Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
“O BEIJO” EM ARTE .
“O BEIJO” EM ARTE                       .“O BEIJO” EM ARTE                       .
“O BEIJO” EM ARTE .
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
 
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading Room
Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading RoomImplanted Devices - VP Shunts: EMGuidewire's Radiology Reading Room
Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading Room
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptx
 
II BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING II
II BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING IIII BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING II
II BIOSENSOR PRINCIPLE APPLICATIONS AND WORKING II
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
philosophy and it's principles based on the life
philosophy and it's principles based on the lifephilosophy and it's principles based on the life
philosophy and it's principles based on the life
 
How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 

For part B use BFS and with another loop. There is a group of p Ava .pdf

  • 1. For part B use BFS and with another loop. There is a group of p Ava DuVernay fans (or ADFs for short) who have booked an entire movie theater for a screening of A Wrinkle in Time . Out of the p(p1)/2 possible pairs, f pairs of ADFs are friends. The movie theater is called the Square Theater and has p rows with each row having exactly p chairs in them. (If it helps, you can assume that the p2 chairs are arranged in a "grid" / "matrix" form where each of the p rows has p chairs each and each of the p columns has p chairs each.) The ADF organization committee has come to you to help them efficiently solve the following seating problem for them. Informally, you want to seat the ADFs so that friends can talk to each other (and "distant" friends remain distant). Next, we make this informal description more formal. A seating (as you might expect) is an assignment of the p ADFs to the p2 chairs in the theater so that each ADF gets his/her own chair. A seating is called admissible if 1. for every pair of friends (b1,b2), they can talk to each other during the movies 2. some ADF is assigned a seat in the first row and 3. the seating satisfies the distance compatible property. The ADFs have been to the Square theater before so they have figured out that two people can talk to each other if and only if they are either - seated in the same row or - are seated in the rows next to them (i.e. either to the row directly in front or the row directly behind. The first and the last row of course only have one row next to them). A seating has the distance compatible property if and only if the following holds. For any b1 who is assigned a seat in the first row and any ADF b2, if b1 and b2 have a friendship distance of d (assuming d is defined), then they have to be seated d or more rows apart. (The friendship distance is the natural definition. Let a friendship path between b1 and b2 be the sequence of ADFs f0=b1,f1,,fk1,fk=b2 (for some k0 ) such that for every 0ik1,(fi,fi+1) are friends-- the length of such a path is k. The friendship distance between b1 and b2 is the shortest length of any friendship path between them. So if b1 is b2 's friend, they have a friendship distance of 1 and if b2 is a friend of a friend, they have a distance of 2 and so on. The friendship distance is not defined if there is no friendship path between b1 and b2.) Note Note that the above property is not defined for all pairs of ADFs b1 and b2. (Indeed the problem you will be asked to solve is impossible if the distance compatible property has to hold for all pairs.) Note that the above is defined for only those b1 who are seated in the first row (and every possible b2 ). As an example consider the case of p=3 and f=2 as follows. The ADFs are A,B,C and the (A,B) and (B,C) are the pairs of friends. Then an admissible seating is to assign the "left-most" seat on first row to A, the left-most seat in second row to B and the left-most seat on the third row to C. This following is also an admissible seating: B is assigned (any seat) in the first row while A and C are assigned any two seats in the second row. Your final task is to design an O(f+p2) time algorithm that computes an admissible seating, given as input the set of p ADFs and the set of f pairs of ADFs who are friends. Here are the two parts:
  • 2. (a): Formalize the problem above in terms of graphs: i.e. write down i. How you would represent the input as a graph G; ii. How you would define a seating and iii. Define what it means for a seating to be admissible in terms of properties of graph G. (b) Using part 1 or otherwise design an O(f+p2) time algorithm to compute an admissible seating. (Recall that your algorithm should work for any set of p eople and any possible set of f friendships.) You should prove the correctness of your algorithm. You also need justify the running time of your algorithm.