Skip to content

Latest commit

 

History

History
34 lines (21 loc) · 1.2 KB

Ex_1_3_37.md

File metadata and controls

34 lines (21 loc) · 1.2 KB
title date draft tags categories
Algorithm4 Java Solution 1.3.37
2019-07-04 05:47:10 +0800
false
JAVA
TECH
archives

1.3.37

Problem:

Josephus problem. In the Josephus problem from antiquity, N people are in dire straits and agree to the following strategy to reduce the population. They arrange them- selves in a circle (at positions numbered from 0 to N–1) and proceed around the circle, eliminating every Mth person until only one person is left. Legend has it that Josephus figured out where to sit to avoid being eliminated. Write a Queue client Josephus that takes N and M from the command line and prints out the order in which people are eliminated (and thus would show Josephus where to sit in the circle).

Solution:

solution from official site link

Ex_1_3_37.java

Reference:

wiki-josephus

medium-josephus

youtube-josephus

geeks-josephus