1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
iris [78.8K]
3 years ago
12

Suppose there are n chairs in a row. We want to compute the number of ways to put 2 students into seats so that they are not nex

t to each other. Assume that students are interchangeable: e.g., if n = 3, the solution should be 1, because the only way to accomplish this is to use the first and last chairs. For both parts to this problem, you must explain why your answer is correct: it is not sufficient to compute a few values directly and look for a pattern.
a. Write a recurrence relation describing the number of ways to put the 2 students into seats so that they are not next to each other.
b. Repeat part a, but now suppose the chairs are in a circle (hint: it might help if you label the chairs 1, ... n, even though they are in a circle without a 'start' or 'end').

Engineering
1 answer:
icang [17]3 years ago
8 0

Complete Question

The complete question is shown on the first uploaded image

Answer:

a) f_{(n)} = f_{(n-1)} + n-2

b) g_{(n)} = g_(n+1) + (n-2)

Explanation:

The explanation is shown on the second and third uploaded image

You might be interested in
13. Write a function which is passed two strings. The function creates a new string from the two original strings by copying one
attashe74 [19]

Answer:

I am writing the code in C++. Let me know if you want the program in some other programming language.

#include <iostream>  // includes header file for input output functions

using namespace std;     //to identify objects like cin cout

string CopyStrings(string string1, string string2)  

{   string newString = "";    

   for (int loop = 0; loop < string1.length() ||  

                   loop < string2.length(); loop++)      {      

       if (loop < string1.length())  

           newString += string1[loop];          

       if (loop < string2.length())  

           newString += string2[loop];      }  

   return newString;   }  

int main()  

{   string stringA = "ace";  

   string stringB = "bdf";  

   cout << CopyStrings(stringA, stringB);   }

Output:

abcdef

Explanation:

The function CopyStrings() function takes two strings i.e. string1 and string2 as parameters to copy characters from both the string one character from each.

The newString variable stores the new string after copying characters from both strings string1 and string2.

Then the for loop starts which has a variable loop which is an index variable that traverses through both the strings stored in string1 and string2. The loop continues to execute until it moves through entire length of string1 and string2 which means it copies all the characters from both string1 and string2. length() is used here which returns length of the string1 and string2.

If statement in the for loop checks the character that loop (index) variable is pointing to is less than the string1 length which means it checks each character stored in string1. For example if string1 contains "ace" and loop variable is moving through the string and is currently at "a" then this condition is true. If the condition evaluates to true then the body of if statement is executed. The next statement stores that character a into the newString variable.

Next If statement checks character that loop variable is pointing to is less than the string2 length which means it checks each character stored in string2. For example if string2 contains "bdf" and loop variable is moving through the string and is currently at "b" then this condition is true. If the condition evaluates to true then the body of if statement is executed. The next statement stores that character b into the newString variable.

Then the second iteration starts which again first stores the next character i.e. c from string1 into newString and then stores next character i.e d from string2 into newString.

Then the third iteration starts which again first stores the next character i.e. e from string1 into newString and then stores next character i.e f from string2 into newString.

Then the loop breaks as the loop variable reaches end of both the string1 and string2.

return newString will return the copied string into the output screen which is abcdef.

The screenshot of code along with output is attached.

3 0
3 years ago
Convert mechanical energy into electric energy. What can he use?
Nina [5.8K]

Answer:

<h2>Generator </h2>

Explanation:

A generator converts mechanical energy into electrical energy

7 0
3 years ago
A system consists of N very weakly interacting particles at a temperature T sufficiently high so that classical statistical mech
algol [13]

Answer:

the restoring force is = 3/4NKT

Explanation:

check the attached files for answer.

7 0
4 years ago
What is A roofed structure that is similar to a porch, but is detached from the house.
agasfer [191]

Answer:

a gazebo

Explanation:

6 0
3 years ago
Read 2 more answers
4. The outer end of a control arm is attached to the steering knuckle through a
arlik [135]
Is attached to the spring
3 0
3 years ago
Read 2 more answers
Other questions:
  • A 10-kg block A is released from rest 2 m above the 5-kg plate P, which can slide freely along the smooth vertical guides BC and
    6·1 answer
  • Technician A says that thrust angle refers to the direction the front wheels are pointing. Technician B says that scrub radius r
    11·1 answer
  • 10. The repair order is a legal document because
    7·1 answer
  • If you were choosing between two strain gauges, one which has a single resistor in a bridge that varies and one that has two res
    11·1 answer
  • A hollow, spherical shell with mass 2.00kg rolls without slipping down a slope angled at 38.0?.
    15·1 answer
  • I will put other link in comments
    12·1 answer
  • Make a sketch of a simple mechanically expanded brake and indicate the forces ​ ​ acting on the leading shoe when the brake is a
    10·1 answer
  • What are the specifications state that all work shall be done?
    10·1 answer
  • 8. If you push a 2000 N weight up a ramp with 400 N of force and you raise the weight 1 meter,
    9·1 answer
  • A type of adjustable square that can be used to set, test, and transfer angles is called a
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!