Use a circular list to implement the josephus problem in


Use a circular list to implement the Josephus Problem. In the Josephus Problem, there is originally a circle of people numbered from one to n. Some number is chosen as the starting person, and an interval of size m is selected. Then, starting at the chosen person, every mth person is eliminated until only one person remains. The output should be a list of the eliminated people in the order of elimination, and a statement of which person remains. Do this once with the circular list class implemented with nodes and pointers and once as a circular array with some method of designating a person as "not there." The two implementations of the circular list should be designed to require no change to the code outside the circular list class. Both circular list classes should have functions AdvanceN(n) and DeleteThis(x), where AdvanceN(n) returns a new position in the list that is n places further on, and DeleteThis(x) deletes person x and returns the position previous to x.

Request for Solution File

Ask an Expert for Answer!!
Dissertation: Use a circular list to implement the josephus problem in
Reference No:- TGS02263614

Expected delivery within 24 Hours