subject

In an ancient land, the beautiful princess Eve (or handsome prince Val) had many suitors. Being royalty, it was decided that a special process must be used to determine which suitor would win the hand of the prince/princess. First, all of the suitors would be lined up one after the other and assigned numbers. The first suitor would be number 1, the second number 2, and so on up to the last suitor, number n. Starting at 4 the suitor in the first position, she/he would then count three suitors down the line (because of the three letters in his/her name) and that suitor would be eliminated and removed from the line. The prince/princess would then continue, counting three more suitors, and eliminate every third suitor. When the end of the line is reached, counting would continue from the beginning. For example, if there were 6 suitors, the elimination process would proceed as follows:. 12456 Suitor 3 eliminated; continue counting from 4.
1245 Suitor 6 eliminated; continue counting from 1.
125 Suitor 4 eliminated; continue counting from 5.
15 Suitor 2 eliminated; continue counting from 5.
1 Suitor 5 eliminated; 1 is the lucky winner.
Write a program that creates a circular linked list of nodes to determine which position you should stand in to marry the princess if there are n suitors. Your program should simulate the elimination process by deleting the node that corresponds to the suitor that is eliminated for each step in the process.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 07:50
Most shops require the technician to enter a starting and ending time on the repair order to track the actual time the vehicle was in the shop and closed out by the office. this time is referred to as _ time ? a. comeback b. ro c. cycle d. lead
Answers: 1
question
Computers and Technology, 25.06.2019 22:30
If you were working on a mainframe, which of the following operating systems would you most likely be using?
Answers: 1
question
Computers and Technology, 26.06.2019 02:00
Which management technique was developed by the us defense establishment? a. work breakdown structure b. work allocation structure c. project planning structure d. resource plan structure
Answers: 1
question
Computers and Technology, 26.06.2019 05:00
How many answers do you need to be able to write messages on here? ?
Answers: 2
You know the right answer?
In an ancient land, the beautiful princess Eve (or handsome prince Val) had many suitors. Being roya...
Questions
question
Chemistry, 16.10.2020 21:01
question
Arts, 16.10.2020 21:01