Question: please solve this using quesues only in C language ! In the Josephus problem from antiquity, N people are in dire straits and agree to

please solve this using quesues only in C language !
In the Josephus problem from antiquity, N people are in dire straits and agree to the following strategy to reduce the population. They arrange themselves 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.
Learn more about the problem here: The Josephus Problem - Numberphile.
Implement the function josephus(n,m) in queue.c.
You MUST use your Queue to solve this problem. If you use any arrays in any part of this solution, your code will be rejected.
The function takes two integers as input. The integers are n and m. Your program will print the people in the order in which they are eliminated.
Josephus will sit in whatever value is printed last. You must use your Queue from the previous part to solve this problem.
Additional Notes
You may assume the user will always give two positive numbers.
You may assume the user will always enter values such that n > m.
Print a newline instead of a space after the last person
Joesphus Test 01
%./main
Select Option from list.
0.) Run All Tests
1.) Test New Queue
2.) Test Enqueue
3.) Test Front
4.) Test isEmpty
5.) Test Dequeue
6.) Run Randomized Tests
7.) Josephus Puzzle
Enter Number of test to run:
7
Enter Number of People (N):
7
Enter Person to Eliminate (M):
2
Order Eliminated:
1350426
Josephus Test 02
%./main
Select Option from list.
0.) Run All Tests
1.) Test New Queue
2.) Test Enqueue
3.) Test Front
4.) Test isEmpty
5.) Test Dequeue
6.) Run Randomized Tests
7.) Josephus Puzzle
Enter Number of test to run:
7
Enter Number of People (N):
7
Enter Person to Eliminate (M):
3
Order Eliminated:
2516403
/**
Solve the Josephus Puzzle Using a Queue. Print out the people in the order
killed. Josephus sits in the last position printed.
@param n is the number of people
@param m is the m-th person to kill, m=2 means kill every other person
*/
void josephus(int n, int m);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!