Problem 3. In the Josephus problem, n people stand in a circle waiting to be executed. The counting starts at some point

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Problem 3. In the Josephus problem, n people stand in a circle waiting to be executed. The counting starts at some point

Post by answerhappygod »

Problem 3. In the 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 specifc direction around the circle. In
each step, a certain number of people are skipped and the next
person is executed (or eliminated). The elimination of people makes
the circle smaller and smaller. At the last step, only one person
remains who is declared the ‘winner’. Therefore, if there are n
number of people and a number k which indicates that k–1 people are
skipped and k–th person in the circle is eliminated, then the
problem is to choose a position in the initial circle so that the
given person becomes the winner.
Write a program to do the following tasks:
a) Implement a queue.
b) Find the solution of the Josephus problem using queue
P/S: USING LANGUAGE C++ PLS!!!
How to run it?
I want it to be in a class.
ONLY 1 FILE!!!
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply