Question: (10 pts) You want to write a function RangeRemoval for a sorted doubly linked lists that will have two parameters, low and high value defining

 (10 pts) You want to write a function RangeRemoval for a

(10 pts) You want to write a function RangeRemoval for a sorted doubly linked lists that will have two parameters, low and high value defining a range of integers (you can assume the second parameter is less than or equal to the third parameter). Your task is to remove all values in the list, whose elements are between the second and third parameters, inclusive, from the parameter list, and to return a sorted list of those removed values. For example, if the list were of size 12 and was as follows: head >0>1>2>4>5>7>8>9>11>12>15>17> NULL and your second and third parameters were 6 and 12 , respectively, then the parameter list becomes: head >0>1>2>4>5>15>17> NULL and you return a pointer to the start of the list: 7>8>9>11>12>NULL where the last node's next variable is NULL and the values are sorted. You are NOT allowed to write to the element variable of any of the nodes; you must complete this method by rearranging the nodes themselves. When you are done, the parameter list should still be doubly-linked, the next variable of the first node and the prev variable of the last node should both point to NULL, and the parameter should point to the new front node of the list. You may assume you have the following definitions: public class Node \{ int data; Node next, prev; \} public class MyLinkedList Node head; / Write your code here

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!