Question: Using the following code, I need to m odify the node class to implement a circular doubly linked list and to s olve the circular

Using the following code, I need to modify the node class to implement a circular doubly linked list and to solve the circular drawing problem described below using the circular doubly linked list. A travel agent selects n customers to compete in the finals of a contest for a free world cruise. The agent places the customer in a circle and then draws a number m(1ollowing figure illustrates the problem for n=6 and m=3. The winner is 2 The program assumes that n contestants compete for the cruise and that the deselection process removes every mth contestant. The value n and m are function arguments and provided by the user. A circular doubly linked list stores the contestants with integer values 1, 2, 3, ....n. In an iterative process, the algorithm sequences through the ring of remaining nodes and removes the mth node from the list. Because there are n contestants for the cruise, the function uses n-1 iterations. The process starts by assigning a node pointer to reference the first node. Starting with this node, a series of m-1 steps moves the pointer forward to the location of the node to remove. To avoid invalidating the pointer when we delete the node, we first move the pointer forward one position and then delete the predecessor node. The next iteration picks up at the current pointer position and repeats the process of moving the pointer forward m-1 steps and deleting a node. At an even turn, all the previous processes are same except that the forward movements are substituted by backward movements. At the end of the n-1 iterations, the pointer identifies the winner of the cruise.Of course, you can get an answer without using a circular doubly linked list. For example, you can somehow store the predecessor node pointer every time you advance/reverse to the next node.However, in this homework, you need to implement it using a circular and doubly linked list.Using the following code, I need to modify the node class toYou need to develop a short main function that takes the user's n and m values (n>m). At each iteration, you should print the deselected contestant. The function terminates by displaying the winner.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!