n), starting point (i), direction (clockwise/anti-clockwise) and number to be skipped (k). Your program then must populate a circular linked list with n nodes where data of each node should be their position in the circle (starting from 1). Your program should then work iteratively pri

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 16PE: The implementation of a queue in an array, as given in this chapter, uses the variable count to...
icon
Related questions
icon
Concept explainers
Question

Your task is to develop a circular linked-list based simulation of the Josephus problem. The
simulation will be text based. The user should be presented with a text-based menu asking him to
enter the total number of people (n), starting point (i), direction (clockwise/anti-clockwise) and
number to be skipped (k). Your program then must populate a circular linked list with n nodes
where data of each node should be their position in the circle (starting from 1).
Your program should then work iteratively printing the remaining persons after each iteration
(round of killing). After the last iteration only the node with the winning initial position should be
left in the list.

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Types of Linked List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning