SlideShare a Scribd company logo
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 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
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
 
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
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
 
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
fmac5
 
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
fmac5
 
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
fmac5
 
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
fmac5
 
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
fmac5
 
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
fmac5
 
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
fmac5
 
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
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

How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Diana Rendina
 

Recently uploaded (20)

How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
 

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.