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:10
Acompressor receives the shaft work to decrease the pressure of the fluid. a)- true b)- false
Answers: 3
question
Engineering, 04.07.2019 18:10
Afour cylinder four-stroke in-line engine has a stroke of 160mm, connecting rod length of 150mm, a reciprocating mass of 3kg and its firing order is 1-3-4-2. the spacing between cylinders is 100mm. i. show that the engine is in balance with regard to the primary inertia forces and primary 3. a and secondary inertia couples. li determine the out of balance secondary inertia force ii. propose ways of balancing this out of balance force and discuss the challenges that will arise
Answers: 3
question
Engineering, 04.07.2019 18:10
Ahot wire operates at a temperature of 200°c while the air temperature is 20°c. the hot wire element is a tungsten wire of 5 um diameter and 2 mm in length. plot using excel current, heat transfer and heat generated by the wire for air velocity varying from 1-10 m/s in steps of lm/s? matlab the sensor voltage output, resistance, or assume nu 0.989 re033pr13 take air properties at tr (200°c20°c)/2 = 110°c properties of tungsten: c 0.13 kj/kg.k 3 p 19250 kg/m k (thermal conductivity) = 174 w/m.k
Answers: 2
question
Engineering, 04.07.2019 18:10
Journeyman training is usually related (clo2) a)-to specific tasks b)-to cost analysis of maintenance task c)-to control process to ensure quality d)-to installation of machinery
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
Biology, 17.10.2021 01:00
question
Physics, 17.10.2021 01:00
question
Mathematics, 17.10.2021 01:00