Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Problem:

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.

  • Solve without using a Template
  • There are two parts to this question - Do this once with the circular list class implemented with nodes and pointers and once as a circular array (do not use pointers here.  Integers will work fine) with some method of designating a person as "not there."
  • The program should allow the user to cin >>startingPerson and cin>>intervalSize
  • The class(es) should be declared in a separate .h file(s).

Additional Information:

This question is from Computer Science and it explains about writing program in C++ which implements Josephus problem. Josephus problem is the classical problem on counting out people. This problem has been implemented and solved using C++ program.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91399305
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Computer Engineering

A group of students made the following scores on a 10-item

A group of students made the following scores on a 10-item quiz in psychological statistics: {5, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10} What is the variance, treating these scores as a sample?

Question suppose the array begins with 0 followed by the

Question : Suppose the array begins with 0, followed by the remaining even integers in descending order, followed by the odd numbers in descending order. (For n = 8, the array would be [0,8,6,4,2,7,5,3,1].) How many comp ...

1nbsphillary wants to go to disneyland in 425 years she

1) Hillary wants to go to Disneyland in 4.25 years. She wants to take her partner and 2 kids (4 people in Total). If it is going to cost $453.27 per person to go on the trip. -What will the cost be for the entire trip? - ...

Question suppose that the tuition for a university is 10000

Question : Suppose that the tuition for a university is $10,000 this year and increases 5% every year. In one year, the tuition will be $10, 500. Write a program that displays the tuition in ten years and the total cost ...

Roberto is the network administrator for an international

Roberto is the network administrator for an international law firm with offices and customers in North America, South America, Africa, and the Middle East. The lawyers frequently contact each other via e-mail, use the In ...

Ellen is an anthropologist who has been working at olduvai

Ellen is an anthropologist who has been working at Olduvai Gorge in Tanzania for the past six months. She has been conducting research on the Internet. She finds a Web site with an article that proposes a revolutionary t ...

Stacksthere are two main operations associated with stacks1

Stacks There are two main operations associated with stacks; 1) putting things on the stack which is referred to as push, 2) taking things from the stack which is referred to as pop. We can create a stack using linked li ...

Answer the following question where does the responsibility

Answer the following Question : Where does the responsibility of the software developer reside in considering the discrimination in techonology based on gender race and disability? How do you think it affects you as a pr ...

Question imagine you are a junior researcher at a

Question: Imagine you are a junior researcher at a world-renowned, high-tech laboratory that receives millions of dollars in government grants each year. You have been assigned the task of writing a proposal for the DARP ...

During a year of operation a firm collects 650000 in

During a year of operation, a firm collects $650000 in revenue and spends $250000 on labor expense, raw materials, rent, and utilities. The firm's owner has provided $350000 of her own money instead of investing the mone ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As