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

  Working for country club with thousands of members

Working for country club with thousands of members

  Prompt the user to enter a string

Prompt the user to enter a string, and using a loop, count and output the number of vowels, and consonants the string contains. (find methods from class Character to help you.)

  Describe rapid adoption of software as a service

The popularity and rapid adoption of Software as a Service (SaaS), Platform as a Service (PaaS), and Infrastructure as a Service (IaaS) by a number of organizations has impacted internal IT / IS departments.

  Profession might be held liable for negligence

The paper should be 5 to 7 typed pages. Professional Liability-select an allied health (nonphysician) profession; this can be your own profession or another profession that interests you. Some examples of allied health professions include phys..

  Database-related except the history of databases

You can write about anything database-related except the history of databases. You must find something that relates to current and future issues in databases; the following Web site, www.sqlservercentral.com, is an excellent source for ideas.

  Select a real or hypothetical business engaged in e-busines

Step 1: Establish a target audience and scope for your presentation. Select a real or hypothetical business engaged in e-business and outline its central offerings and/or services. Next, outline the categories of information that may require c..

  Write a fragment of code

Write a fragment of code that will read words from the keyboard until the word done is entered. For each word except done, report whether its first character is equal to its last character. For the required loop, usea a.While statment b. do-while ..

  How to successful interface designer

how to successful interface designer

  Which method would be efficient for planning proactive

Process-centered review of object oriented software development methodologies, ACM Computing Surveys (CSUR), Volume 40 Issue 1, February 2008, Raman Ramsin, and Richard F. Paige.

  Calculate the average cpi for each machine

Calculate the average CPI for each machine, M1, and M2 and calculate the average MIPS ratings for each machine, M1 and M2.

  What is the difference between println and printf

What is the difference between println and printf? Show an example of the usage of each.

  Write a create table statement that recreastes the table

write a create table statement that recreastes the table, this time with a unique constraint that prevents an individual from being a memeber in the same group twice.

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