algorithm - How many different possible ways can persons be seated in a round table? -


I am developing an algorithm and seeing the possibility of maximum iterations before reaching a conclusion.

In the real world, it is similar to the problem of classical round table sitting. Can you please tell me that without any repetition, can a person be seated on a round table?

Thanks

Find out through the solution of this problem.

First of all, let's see how many ways we can arrange N people in a row. There are different people that we can put in front of the line. Any N-1 can be placed in the second place of N-1 living. Any N-2 of N-2 living N-2 can be placed at the third position. More generally we get the formula

Arrange of numbers = NX (N-1) X (n - 2) x ... x 1 = n!

So there are n! Different ways to allow people in a row more commonly, there are n! N Different ways to rearrange unique elements.

Now, what happens when we organize people in the ring? For each linear permutation, we can convert that system into two rings together to a ring arrangement. For example, with three people, there are six ways to order them in one line:

  1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1 < / Code>  

This map for the following rings:

  1 1 2 3 - & gt; / \ 3 --- 2 1 1 3 2 - & gt; / \ 2 --- 3 2 2 1 3 - & gt; / \ 3 --- 1 2 2 3 1 - & gt; / \ 1 --- 3 3 3 1 2 - & gt; / \ 2 --- 1 3 3 2 1 - & gt; / \ 1 --- 2   

However, we can not conclude that the number of arrangements for sitting in N! Because we have arranged the same seating here many times. As a trick, suppose we always write cycles so that 1 is on the top of the circle. After this we have created the following cycles:

  1 1 2 3 -> / \ 3 --- 2 1 1 3 2 - & gt; / \ 2 --- 3 1 2 1 3 - & gt; / \ 2 --- 3 1 2 3 1 - & gt; / \ 3 --- 2 1 3 1 2 - & gt; / \ 3 --- 2 1 3 2 1 - & gt; Note that we have generated the following:  
  1 1 / x3 / \ x3 2 --- 3 3 --- 2   

In fact, there are only two different arrangements; We have only produced it three times.

The reason for this is that because the ring does not have any definite start and end, we will create several rotations of each separate system. In particular, if we need some people, then we will prepare different copies of the same rotation, one with each guest at the top. As a result, to get the total number of guests, for each separate ring, we need to ignore them all, but one of them is different copies of each ring, this means that the total number

n! / N = (n - 1)!

So (N-1) are!

Hope this helps!

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -