Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Computer Science I Program 3 : Where to Sit? ( Recursion ) Please Check Webcourses for the Due Date Please read the whole assignment before
Computer Science I Program : Where to Sit? Recursion Please Check Webcourses for the Due Date Please read the whole assignment before you start coding Objective Give practice with recursion. Give practice with functions in Give practice with creating a design for a program without a given list of functions or structs. Background Story You and your friends are planning to get together to attend a movie! However, there are a few restrictions on where everyone can sit: Some people don't want to sit next to each other. Everyone should have access to popcorn! This means that for each person, either they bought popcorn, or the person directly to their left or the person directly to their right did. For example, imagine that there are five people who want to attend the movie: Alia, Belinda, Carlos, Danica and Edward, where only Alia and Edward buy popcorn. In addition, Alia and Carlos can't sit next to each other and Belinda and Edward can't sit next to each other. Given these restrictions, they can sit in a single row in possible orders. tableAliaBelinda,Carlos,Edward,DanicaAliaBelinda,Danica,Edward,CarlosBelindaAlia,Danica,Carlos,EdwardBelindaAlia,Danica,Edward,CarlosCarlosEdward,Danica,Alia,BelindaCarlosEdward,Danica,Belinda,AliaDanicaAlia,Belinda,Carlos,EdwardDanicaEdward,Carlos,Belinda,AliaEdwardCarlos,Belinda,Alia,DanicaEdwardCarlos,Danica,Alia,Belinda Problem Write two related programs where, given the list of people who are going to the movies together, the pairs of people who can't sit next to each other, and the list of people who are buying popcorn, determines the two following things: Program the number of different orderings permutations of the movie attendees that satisfy all the restrictions. Program the first ordering in lexicographical order of the movie attendees that satisfy all the restrictions.
Computer Science I Program : Where to Sit? Recursion
Please Check Webcourses for the Due Date
Please read the whole assignment before you start coding
Objective
Give practice with recursion.
Give practice with functions in
Give practice with creating a design for a program without a given list of functions or structs.
Background Story
You and your friends are planning to get together to attend a movie! However, there are a few restrictions on where everyone can sit:
Some people don't want to sit next to each other.
Everyone should have access to popcorn! This means that for each person, either they bought popcorn, or the person directly to their left or the person directly to their right did.
For example, imagine that there are five people who want to attend the movie: Alia, Belinda, Carlos, Danica and Edward, where only Alia and Edward buy popcorn. In addition, Alia and Carlos can't sit next to each other and Belinda and Edward can't sit next to each other. Given these restrictions, they can sit in a single row in possible orders.
tableAliaBelinda,Carlos,Edward,DanicaAliaBelinda,Danica,Edward,CarlosBelindaAlia,Danica,Carlos,EdwardBelindaAlia,Danica,Edward,CarlosCarlosEdward,Danica,Alia,BelindaCarlosEdward,Danica,Belinda,AliaDanicaAlia,Belinda,Carlos,EdwardDanicaEdward,Carlos,Belinda,AliaEdwardCarlos,Belinda,Alia,DanicaEdwardCarlos,Danica,Alia,Belinda
Problem
Write two related programs where, given the list of people who are going to the movies together, the pairs of people who can't sit next to each other, and the list of people who are buying popcorn, determines the two following things:
Program the number of different orderings permutations of the movie attendees that satisfy all the restrictions.
Program the first ordering in lexicographical order of the movie attendees that satisfy all the restrictions.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started