0% found this document useful (0 votes)
2 views1 page

Solving the Josephus Problem

The document discusses the Josephus Problem, illustrating how a circular linked list can be used to solve it. In the example, 10 persons sit in a circle and eliminate every fourth person until only one remains. The process involves creating a circular linked list and executing players based on the counting method described.

Uploaded by

Nancy P
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Solving the Josephus Problem

The document discusses the Josephus Problem, illustrating how a circular linked list can be used to solve it. In the example, 10 persons sit in a circle and eliminate every fourth person until only one remains. The process involves creating a circular linked list and executing players based on the counting method described.

Uploaded by

Nancy P
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Josephus Problem

A case where circularly linked list is handy to provide the solution of the Josephus
Problem.
Consider there are 10 persons. They would like to choose a leader.
The way they decide is that all 10 sit in a circle.
They start a count with person 1 and go in clockwise direction and skip 3. Person 4 reached
is eliminated.
The count starts with the fifth and the next person to go is the fourth in count.
Eventually, a single person remains.

Example

Creation of Circular Linked List

Removing a Player (Executing / Killing) and printing the winner

You might also like