In the great city of Atlantis, Prince Val had many sultors. He decided on the following...
Fantastic news! We've Found the answer you've been seeking!
Question:
![](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2023/09/64f6e11a32660_1693901081327.jpg)
![](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2023/09/64f6e136ab47b_1693901111319.jpg)
Transcribed Image Text:
In the great city of Atlantis, Prince Val had many sultors. He decided on the following algorithm to determine which person he would marry. First, the suitors would be lined up in order and assigned a number starting with 1. the second would be 2, and so on up to n sultors. Starting with the first, he would count down the line with each letter of his name "V", "a", "I", and then the suitor at "I" would be eliminated from the line. Val would continue counting three more suitors, and eliminating every third one. When Val reached the end of the line, he would resume counting at the beginning of the line. For example, if there were seven suitors, the elimination process would be as follows: Initial list of suitors; Start counting from 1. Suitor #3 eliminated; Suitor #6 eliminated; Suitor #2 eliminated; Suitor #7 eliminated; Suitor #S eliminated; Continue counting at 4. Continue counting at 7. Continue counting at 4. Continue counting at 1. Continue counting at 1. Finally, #1 is eliminated, and suitor #4 is selected. 1234567 124567 12457 1457 145 14 4 Write a program that implements a linked list of nodes to determine the position a suitor should stand if they want to marry the prince, when there are n suitors. Your program should eliminate the suitor by deleting the node corresponding to the suitor for each step of the process. Each sultor also has a name. You should either add the name, a string, as part of the node object or use a parallel HashMap to perform a name lookup. Your program should prompt the user for the number of suitors, each suitor's name, and then after your algorithm runs, print the selected suitor and their name. Be sure to use prompts that make sense to a user who has never run your program before. In the great city of Atlantis, Prince Val had many sultors. He decided on the following algorithm to determine which person he would marry. First, the suitors would be lined up in order and assigned a number starting with 1. the second would be 2, and so on up to n sultors. Starting with the first, he would count down the line with each letter of his name "V", "a", "I", and then the suitor at "I" would be eliminated from the line. Val would continue counting three more suitors, and eliminating every third one. When Val reached the end of the line, he would resume counting at the beginning of the line. For example, if there were seven suitors, the elimination process would be as follows: Initial list of suitors; Start counting from 1. Suitor #3 eliminated; Suitor #6 eliminated; Suitor #2 eliminated; Suitor #7 eliminated; Suitor #S eliminated; Continue counting at 4. Continue counting at 7. Continue counting at 4. Continue counting at 1. Continue counting at 1. Finally, #1 is eliminated, and suitor #4 is selected. 1234567 124567 12457 1457 145 14 4 Write a program that implements a linked list of nodes to determine the position a suitor should stand if they want to marry the prince, when there are n suitors. Your program should eliminate the suitor by deleting the node corresponding to the suitor for each step of the process. Each sultor also has a name. You should either add the name, a string, as part of the node object or use a parallel HashMap to perform a name lookup. Your program should prompt the user for the number of suitors, each suitor's name, and then after your algorithm runs, print the selected suitor and their name. Be sure to use prompts that make sense to a user who has never run your program before.
Expert Answer:
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date:
Students also viewed these programming questions
-
Please do this problem in C++. Provide proper commenting (this is crucial) and make sure it compiles and runs well with NO ERRORS. Write a function that takes as a parameter a list or vector and...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
Mr. Lawrence had been the manager at Pleasure Sdn Bhd (PSB) since 1 February 2016. His employment was terminated on 30 April 2021 due to disputes with the directors of PSB. After many appeals,...
-
A relative sends you a U.S. government savings bond that matures in n years with a face value of $100. This means that the holder of this bond is entitled to collect $100 from the government n years...
-
What is the crossed-strings method? For what kinds of geometries is the crossed-strings method applicable?
-
Over absorption = actual > estimated.
-
Sharon Evans, who graduated from the local university 3 years ago with a degree in marketing, is manager of Ann Naylor's store in the Southwest Mall. Sharon's store has 5 years remaining on its...
-
DiDonato Supplies manufactures two versions of presentation remotes: Basic and Laser. Both models go through the same assembly process and are produced in the same plant. The difference between the...
-
The analyst in the Dorben Company made 10 independent time studies in the hand paint spraying section of the finishing department. The product line under study revealed a direct relation between...
-
Write a summary of all the government forms/reports used for payroll described in chapters 7 and 8 and explain their purpose. W-4 Withholding Form 940 tax Form 941 Tax W-2
-
Salmone Company reported the following purchases and sales of its only product. Salmone uses a perpetual inventory system. Determine the cost assigned to the ending inventory using FIFO. 1 Date...
-
A company may go through organizational change at various stages in its life cycle for a variety of reasons. Reasons can include a change in ownership as well as a change in the competitive...
-
6 (a) Below is a diagram of a rotating disc viscometer (FIGURE 4). Explain its operations and limitations as to use. If, in a similar works situation, it is necessary to make measurements on a...
-
As part of your role in the Business Analytics and Data Analytics team, you have been asked to forecast Food Retailing as part of a wider report being commissioned by the above collaboration - on...
-
You are three students who have together bought a business that makes snow. The customers consist of both large public enterprises and private individuals. The business is run all year round, but the...
-
Discuss on the chargeability to income tax on the payments/ benefits received by an employee: A special training course in enhancing the employees skills? A loan provided to an employee? A life...
-
l ask this second time correnct answer is 38,01 can we look pls Consider a non-conducting rod of length 8.8 m having a uniform charge density 4.5 nC/m. Find the electric potential at P, a...
-
On August 12, Mr. and Mrs. Mitchell, the owners of a small secondhand store, attended Alexanders Auction, where they bought a used safe for $50. The safe, part of the Sumstad estate, contained a...
-
Amalgamated Corporation, organized under the laws of State S, sends several traveling salespersons into State M to solicit orders, which are accepted only at the home office of Amalgamated...
-
Dryden, a certified public accountant, audited the books of Elixir, Inc., and certified incorrect financial statements in a form that was filed with the Securities and Exchange Commission. Shortly...
-
CI9.9. What is a default strategy?
-
e19.6. What is a default point?
-
C19.5. Distinguish a Type I errorin predicting default from a Type II error.
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App