Josephus problem implementation in C
Josephus problem is a puzzle problem. A group of people are there. They stand in a circle. Every kth person is eliminated until only one remains. To solve this problem, circular linked list is the best option. C implementation: This implementation starts from creating Node structure. It has a data and node. There is a function create_Circle(). It is used to create the memory for node. Create the nodes as circular linked list. Josephus elimination function reads the input as number of persons and k value. Using the k value, keep on moving the circular linked list. The kth person is eliminated until the last one is remaining. Code: #include <stdio.h> #include <stdlib.h> //create a Node structure with data and node struct cl_Node { int data; struct cl_Node *next; }; // circular link...