Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do problem 5.5 on pages 248-249 in the Data Structures and Algorithems in Java (2nd edition)using Java (one file only--multiple classes ok). The input will

Do problem 5.5 on pages 248-249 in the Data Structures and Algorithems in Java (2nd edition)using Java (one file only--multiple classes ok). The input will be a sequence of 3 ints entered from the keyboard (separated only by one or more blanks), such as 7 1 3 as in problem 5.5. This kind of input can be entered again and again until the user enters stop. 7 1 3 means that there are seven items: 1 2 3 4 5 6 7 (the numbering always starts at 1) and that the holder starts at 1 and that the passing is 3 so that means that the first one eliminated is 4 creating a new list 1 2 3 5 6 7 which now starts holding at 5 and the next one eliminated is 1 creating a new list 2 3 5 6 7 which now starts holding at 2 and the next one eliminated is 6 creating a new list 2 3 5 7 which now starts holding at 7 and the next one eliminated is 5 creating a new list 2 3 7 which now starts holding at 7 and the next one eliminated is 7 creating a new list 2 3 which now starts holding at 2 and the next one eliminated is 3 creating the final list 2 IN ALL SITUATIONS THE FIRST NUMBER IN THE LIST IS 1. When the user wants to stop the input, it should just be: stop The user should be able to continue providing input after the problem is solved. The output should be sent to the console (lower pane on jGrasp.) Please note also that the first number could be an extremely large int. It might be fun to try a circular linked list in one class , an iterator in another, and then the application itself, but the choice is yours. Try to learn from the concepts of the chapter! JUST PRINT THE FINAL LIST OF A SINGLE int. image text in transcribed 

image text in transcribed

harder, Ullmess you hnun 5.5 The Josephus Problem is a famous mathematical puzzle that goes back . ancient times. There are many stories to go with the puzzle. One is that Josephus was one of a group of Jews who were about to be captured by the Romans. Rather than be enslaved, they chose to commit suicide. They arranged themselves in a circle and, starting at a certain person, started counting off around the circle. Every nth person had to leave the circle and commit suicide. Josephus decided he didn't want to die, so he arranged the rules so he would be the last person left. If there were (say) 20 people, and he was the seventh person from the start of the circle, what number should he tell them to use for counting off? The problem is made much more complicated because the circle shrinks as the counting continues. Create an application that uses a circular linked list (like that in Program Project 5.3) to model this problem. Inputs are the number of people *** circle, the number used for counting off, and the number of the perso ber of the person where

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books