Josephus_permutation Josephus_permutation

Josephus permutation - Definition

Related Words: Avatar, Catabolism, Catalysis, Commutation, Consubstantiation, Cooperation, Displacement, Exchange, Innovation, Interchange, Interplay, Metabolism, Metamorphism, Metamorphosis, Metastasis, Metathesis, Metempsychosis

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 Josephus permutation algorithm can be written in O(n) time.

For the various variations it is possible to find a closed form, enabling the player of such a "game" to determine the position that will be the last one to be eliminated (since, according to tradition, the players eliminate one another, the player in the last postion is the survivor). Quite a detailed description of such a solution can be found in Graham, Knuth and Patashnik, Concrete Mathematics, Addison-Wesley, 1989.

Copyright 2009 WordIQ.com - Privacy Policy  :: Terms of Use  :: Contact Us  :: About Us
This article is licensed under the GNU Free Documentation License. It uses material from the this Wikipedia article.