# The Josephus Problem People are standing in a circle (Links to an external site.)Links to an external site. waiting to

###### Question:

The Josephus Problem

People are standing in a circle (Links to an external site.)Links to an external site. waiting to be executed. Counting begins at a specified point in the circle and proceeds around the circle in a specified direction. After a specified number of people are skipped, the next person is executed. The procedure is repeated with the remaining people, starting with the next person, going in the same direction and skipping the same number of people, until only a specified number of persons remain, and are freed. The problem — given the number of people, starting point, direction, and number to be skipped — is to choose the positions in the initial circle to avoid execution. In the original Josephus problem 41 men stand in a circle and decide to kill every 3rd person until 2 men remain who then kill themselves. Write a function that declares a local queue to solve the original Josephus problem as a special case. The function's prototype is vector solveJosephus( int ncandidates, int nsurvivors);

The function returns the positions in the original circle of the survivors. The function returns an empty vector if any of its parameters is bad. What are the characteristics of a bad parameter?

Data Structure C++. Visual Studios 2017

#### Similar Solved Questions

##### If there are 50 vehicles on a 4000-ft highway lane and the average time headway between...
If there are 50 vehicles on a 4000-ft highway lane and the average time headway between two adjacent vehicles is 2.2 seconds. 3. Calculate traffic density in vehicle/mile (vpm) and average space headway in feet/vehicle (fpv) (1pt) 1) 2) Calculate traffic volume in vehicle/hour (vph). (1pt) 3) Calcul...
##### Question 3 of 3 (2 points) 6.2 Section Exercise 20 If the average price of a...
Question 3 of 3 (2 points) 6.2 Section Exercise 20 If the average price of a new one family home is $246.300 with a standard deviation of$15,000, find the minimum and maximum prices of the houses that a contractor will build to satisfy the middle 40% of the market. Assume that the variable is norma...
##### What is the product of the following reaction? 1.) KMnO4 cold dilute 2.) NaOH O OH...
what is the product of the following reaction? 1.) KMnO4 cold dilute 2.) NaOH O OH + IO||III. H H OH OH enantiomer enantiomer A B D...
##### Part A of the question is answered, what is the answer to Part B? Constants Part...
Part A of the question is answered, what is the answer to Part B? Constants Part A In a hot water heater, water warms when electric potential energy is converted into thermal energy. Determine the energy needed to warm 190 kg of water by 13° C. The specific heat of water is 4180 J/kg-C" Expr...
##### Physical Chemistry, Please show work so I can understand, Thank You! Chemistry 452 2016-10-10 Glucose-Lactate Under...
Physical Chemistry, Please show work so I can understand, Thank You! Chemistry 452 2016-10-10 Glucose-Lactate Under anaarobic conditions glucose is broken down in the muscle tissue to form lactic acid according to the reaction Part D GGH1206 -2CHзсH (он соо&...
##### € Co wb /Studentment Responsep234664178012 12. - POINTS SERCP115.6.P.040. MY NOTES ASK YOUR TEACHER r n...
€ Co wb /Studentment Responsep234664178012 12. - POINTS SERCP115.6.P.040. MY NOTES ASK YOUR TEACHER r n between Nock and (a) A block with a mamis pulled along a hormonal surface for a distance by a constant force at an angle with respect to the hotel. The conto twists the force d by consulto no...
##### Equivalent Units of Production The Converting Department of Hopkinsville Company had 600 units in work in...
Equivalent Units of Production The Converting Department of Hopkinsville Company had 600 units in work in process at the beginning of the period, which were 60% complete. During the period, 12,400 units were completed and transferred to the Packing Department. There were 680 units in process at the ...
##### 2. The rate constants for the reaction CHCI3 (g)+CI (g) CHCI2 (g)+Cl2 (g) at different temperatures...
2. The rate constants for the reaction CHCI3 (g)+CI (g) CHCI2 (g)+Cl2 (g) at different temperatures are tabulated below k (107 M1 s1) T (K) 357 400 1.72 2.53 3.82 458 5.20 524 5.61 7.65 533 615 a. Construct an Arrhenius plot of the tabulated data as presented above b. From the plot, calculate the va...
##### Two charges, Q1= 2.70 μC, and Q2= 5.90 μC are located at points (0,-3.00 cm )...
Two charges, Q1= 2.70 μC, and Q2= 5.90 μC are located at points (0,-3.00 cm ) and (0,+3.00 cm), as shown in the figure. What is the magnitude of the electric field at point P, located at (5.50 cm, 0), due to Q1 alone? 6.18×106 N/C You are correct. Previous Tries What is the x-...
##### Describe 2 (two) methods that will be useful in enhancing data quality? Would internal validity and...
Describe 2 (two) methods that will be useful in enhancing data quality? Would internal validity and reliability be correct for this question or would you recommend something else?...
##### Q5 Q6 Q7 Q8 thx Sloane, Inc., manufactures and sells snowboards. Sloane manufactures a single model,...
Q5 Q6 Q7 Q8 thx Sloane, Inc., manufactures and sells snowboards. Sloane manufactures a single model, the Pipex. In the summer of 2017, Sloane's management accountant gathered the following data to prepare budgets for 2018: Materials and Labour Requirements Direct materials Wood Fiberglass Di...