Josephus Problem
In Josephus problem, "n" people stand in a circle waiting to be executed. The counting starts at some point in the circle and proceeds in a specific direction around the circle.
For example, if there are 5 (n) people and every second (k) person is eliminated, then first the person at position 2 is eliminated followed by the person at position 4 followed by person at position 1 and finally the person at position 5 is eliminated. Therefore, the person at position 3 becomes the winner.
Program for Josephus Problem in C shorturl.at/agMQ3
0 Comments