subject
Engineering, 25.10.2019 20:43 alexanderavrett

Use only c language to do this assignmentin this assignment, you have to simulate the josephus problem. there are n number of prisonersstanding in a circle waiting to be executed. the counting out begins at some point in the circle andproceeds around the circle in a fixed direction. in each step, a certain number of people are skippedand the next person is executed. the elimination proceeds around the circle (which is becomingsmaller and smaller as the executed people are removed), until only the last person remains, whois given freedom. given the total number of persons n and a number k which indicatesthat k-1 persons are skippedand kth person is killed in circle. the task is to choose the place in the initial circle so that you arethe last one remaining and so survive. examplefor example, if n = 5 and k = 2, then the safe position is 3. firstly, the person at position 2 is killed, then person at position 4 is killed, then person at position 1 is killed. finally, the person at position5 is killed. so, the person at position 3 survives. if n = 7 and k = 3, then the safe position is 4. the personsat positions 3, 6, 2, 7, 5, 1 are killed inorder, and person at position 4 survives. input: n and koutput: the position number whowill survive.

ansver
Answers: 3

Another question on Engineering

question
Engineering, 04.07.2019 18:20
Aquick transition of the operating speed of a shaft from its critical speed will whirl amplitude. (a) increase (b) limit (c) not affect (d) zero
Answers: 2
question
Engineering, 04.07.2019 18:20
A2-m rigid tank initially contains saturated water vapor at 100 kpa. the tank is connected to a supply line through a valve. steam is flowing in the supply line at 600 kpa and 300 c. the valve is opened, and steam is allowed to enter the tank until the pressure in the tank reaches the line pressure, at which point the valve is closed. a thermometer placed in the tank indicates that the temperature at the final state is 200°c. determine (a) the mass of steam that has entered the tank (b) the amount of heat transfer.
Answers: 3
question
Engineering, 04.07.2019 19:10
What is creep? what is stress relaxation?
Answers: 1
question
Engineering, 04.07.2019 19:10
Abarometer contains mercury with a density of 13600 kg/m3. atmospheric conditions are 95.8 kpa and 20 °c at 20 °c, the vapor pressure of the mercury is 0.000173 kpa. the column of mercury will rise to a height of most nearly. select one: a)- 0.38 m b)- 0.82 m c)- 0.48 m d)- 0.72 m
Answers: 1
You know the right answer?
Use only c language to do this assignmentin this assignment, you have to simulate the josephus probl...
Questions
question
Advanced Placement (AP), 28.01.2021 16:20
question
Biology, 28.01.2021 16:20
question
Biology, 28.01.2021 16:20
question
English, 28.01.2021 16:20
question
Mathematics, 28.01.2021 16:20
Questions on the website: 13722363