Program which implements josephus problem

Assignment Help Basic Computer Science
Reference no: EM13829443

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.

Reference no: EM13829443

Questions Cloud

How cloud computing is used to solve computing problems : Describe how cloud computing is used to solve computing problems and provide a reason why that item is a benefit to the AEC.
Harvard case study analysis - mountain man brewing : Harvard Case Study Analysis - Mountain Man Brewing
Explain about studies on identical twins being raised apart : The question is from Sociology and the question explain about studies on identical twins being raised apart showing some similarities and lifestyle. This statement has been reviewed and a conclusive proof about the truth of the statement is given.
Differences between leadership and management : What are some differences between leadership and management? How do these differences affect an organization? What are some decisions leaders must make? What are some decisions managers must make
Program which implements josephus 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.
Statements about bonds is true : Which of the following statements about bonds is true? Bond prices move in the same direction as market interest rates. If market interest rates change, long-term bonds will fluctuate more in value than short-term bonds. Long-term bonds are less risk..
An essay on operations and controlling : An essay on Operations and Controlling
Writing a report upon the data and networking needs : Identify an organization and write a report about the organization's data/networking needs and the current LAN use, a current network model with equipment, footage spans, and protocols in use (Topology, Location, Equipment, Protocols).
What is the bonds expected rate of return : The market price is $900 for a 10-year bond that pays 8% interest semi annually. What is the bond's expected rate of return? If the required rate of return is 11%, is this bond overpriced, fairly priced, or underpriced? (Please show your calculation)

Reviews

Write a Review

Basic Computer Science Questions & Answers

  How many strings will be read

You should read a list of strings from a data file (using scanf), and find the minimum and maxium values of the string data. The input file format will start with a single integer that indicates how many strings will be read, and then lists those ..

  Use a one-dimensional c-style array to solve

Use a one-dimensional C-style array to solve the following problem. Read in up to 20 numbers from the keyboard, each of the numbers should be between 10 and 100, inclusive.

  What know by statement mydog setname bowser

what do you know by the following statement: myDog.setName("Bowser")

  Explain material protected under all copyright laws

All rights reserved. This material is protected under all copyright laws as they presently exist. No portion of this material may be reproduced, in any form or by any means, without permission in writing from publisher.

  Distinguish between software agents and pieces of software

How would you distinguish between software agents and other pieces of software? Is the electronic calendar like the one given by MS Office agent?

  Discuss some options for mobile wireless

Please discuss some options for mobile wireless internet connection, and describe the types of hardware that would be involved in making such a connection

  Intelligent systems for health maintenance organization

Aacquiring a company in the health maintenance organization (HMO) field. DSS, ES, ESS, or intelligent systems can be used in such a situation.

  Describe the available materials and services

Describe the available materials and services

  Consider the procedure described in adaptive playout delay

Consider the procedure described in "Adaptive Playout Delay" for estimating average delay di. Let r1 - t1 be the most recent sample delay, let r2 - t2 be the next most recent sample delay.

  Create a square where there are width numbers

Take two numbers as input, a width and height. Create a square where there are WIDTH numbers on each line, and HEIGHT rows

  Discuss how the business requirements drove

Discuss how the business requirements drove the system's initial development. Describe the type and basic uses of the system, how the system has helped the organization, and any likely future development plans.

  Evaluate security testing software

The purpose of this project is to evaluate the student's ability to research and evaluate security testing software and present a proposal for review by executive team members. By completing the document the student will also gain practical knowle..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd