BrainDen.com - Brain Teasers
• 0

# Filling a room

## Question

You have an empty room, and a group of people waiting outside the room. At each step, you may either get one person into the room, or get one out. Can you make subsequent steps, so that every possible combination of people is achieved exactly once?

## 2 answers to this question

• 0

Label each person 1..n.

In the table below the first column represents the person switching their in-room state, the second column lists the people in the room.

Method is:

i. put person 1 in room.

ii. put next person in room, then repeat the sequence of movers that preceded this last entrant. (Of course, they'll be going in the opposite direction, this time.)

iii. repeat step ii. until all 2^n states (including the 0 state the room started in) have been visited.

Proof that the method works is inductive on n. (Left as exercise to reader.)

<empty>

1 1

2 12

1 2

3 23

1 123

2 13

1 3

4 34

1 134

2 1234

1 234

3 24

1 124

2 14

1 4

… …

Edited by austinm

##### Share on other sites
• 0

Proof that the method works is inductive on n. (Left as exercise to reader.)

By the way, I wasn't just being coy here. The proof is a bit interesting--contains one or two knots that have to be thought-through carefully--and is worth taking five minutes to lay out.

## Create an account

Register a new account