Encyclopedia > Josephus permutation

  Article Content

Josephus permutation

In computer science, the Josephus permutation is defined as follows.

Suppose n people are arranged in a circle and we are given a positive integer m < n. Beginning with an arbitrary first person, we proceed around the circle, removing every mth person. After each person is removed, counting continues around the circle until everyone is removed. The order which is removed is the (m,n)-Josephus permutation.

For example, the (3,7)-Josephus permutation is {3,6,2,7,5,1,4}.

The Joesphus permutation algorithm can be written in O(n) time.



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Jamesport, New York

... the average family size is 2.88. In the town the population is spread out with 20.6% under the age of 18, 5.0% from 18 to 24, 26.8% from 25 to 44, 27.7% from 45 to 64, and ...

 
 
 
This page was created in 22.1 ms