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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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