#5 & #6
return true 5. The Josephus problem is named after the historian Flavius Josephus, who lived between the years 37 and 100 CE. Josephus was also a reluctant leader of the Jewish revolt against the Roman Empire. When it appeared that Josephus and his band were to be ca tured, they resolved to kill themselves. Josephus persuaded the group by saying, "Let us tual deaths to determination by lot. He to whom the first lot falls, let him 0 be killed by him that hath the second lot, and thus fortune shall make its progres through us all; nor shall any of us perish by his own right hand, for it would be unfair if, when the rest are gone, somebody should repent and save himself" (Flavius Josephus, The Wars of the Jews, Book III, Chapter 8, Verse 7, tr. William Whiston, 1737). Yet that is exactly what happened; Josephus was left for last, and he and the person he was to kill surrendered to the Romans. Although Josephus does not describe how the lots were assigned, the following approach is generally believed to be the way it was done. People form a circle and count around the circle some predetermined number. When this number is reached, that person receives a lot and leaves the circle. The count starts over with the next person. Using the circular-linked list developed in Exercise 4, simulate this problem. Your program should take two parameters: n, the number of people who start, and m, the number of counts. For example, try n = 20 and m = 12, where does Josephus need to be in the original list so that he is the last one chosen? 2 1 6. To mimic the procedure used by Josephus and his band strictly, the person eliminated 1 remains in the circle until the next one is chosen. Modify your program to take this into account. You may need to modify the circular-linked list class to make a copy of an it ator. Does this change affect the outcome? er return true 5. The Josephus problem is named after the historian Flavius Josephus, who lived between the years 37 and 100 CE. Josephus was also a reluctant leader of the Jewish revolt against the Roman Empire. When it appeared that Josephus and his band were to be ca tured, they resolved to kill themselves. Josephus persuaded the group by saying, "Let us tual deaths to determination by lot. He to whom the first lot falls, let him 0 be killed by him that hath the second lot, and thus fortune shall make its progres through us all; nor shall any of us perish by his own right hand, for it would be unfair if, when the rest are gone, somebody should repent and save himself" (Flavius Josephus, The Wars of the Jews, Book III, Chapter 8, Verse 7, tr. William Whiston, 1737). Yet that is exactly what happened; Josephus was left for last, and he and the person he was to kill surrendered to the Romans. Although Josephus does not describe how the lots were assigned, the following approach is generally believed to be the way it was done. People form a circle and count around the circle some predetermined number. When this number is reached, that person receives a lot and leaves the circle. The count starts over with the next person. Using the circular-linked list developed in Exercise 4, simulate this problem. Your program should take two parameters: n, the number of people who start, and m, the number of counts. For example, try n = 20 and m = 12, where does Josephus need to be in the original list so that he is the last one chosen? 2 1 6. To mimic the procedure used by Josephus and his band strictly, the person eliminated 1 remains in the circle until the next one is chosen. Modify your program to take this into account. You may need to modify the circular-linked list class to make a copy of an it ator. Does this change affect the outcome? er