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 16:10
The force on a cutting tool are 2600n vertically downward and 2100 horizontal. determine the resultant force acting on the tool and the angle at which it acts.
Answers: 1
question
Engineering, 04.07.2019 18:10
Aloaded platform of total mass 500 kg is supported by a dashpot and by a set of springs of effective stiffness 72 kn/m. it is observed that when the platform is depressed through a distance x = 12.5 cm below its equilibrium position and then released without any initial velocity; it reaches its equilibrium position in the shortest possible time without overshoot. find the position and velocity of the loaded platform 0.10 sec. after its release. if a further load of 400 kg is added to the platform, find, i) the frequency of damped vibrations, and i) the amplitude of vibration after 2 complete oscillations, given that the initial amplitude is 15 cm.
Answers: 1
question
Engineering, 04.07.2019 18:10
Which of the following ziegler nichols tuning methods the response of the controller to a step input should exhibit an s-shaped curve? a)-open loop mode b)-closed loop mode c)-both modes (open & closed) d)-none of the modes (open & closed)
Answers: 3
question
Engineering, 04.07.2019 18:10
Which of the following controllers anticipates the future from the slope of errors over time? a)-proportional b)-on/off c)-integral d)-derivative.
Answers: 2
You know the right answer?
Use only c language to do this assignmentin this assignment, you have to simulate the josephus probl...
Questions
question
History, 29.11.2019 13:31
Questions on the website: 13722363