Question: Must be java Prune the Job Queue At Box we process some tasks (e.g. send mobile notifications) using a Job Queue. Job producers enqueue jobs

Must be java

Must be java Prune the Job Queue At Box we process sometasks (e.g. send mobile notifications) using a Job Queue. Job producers enqueue

Prune the Job Queue At Box we process some tasks (e.g. send mobile notifications) using a Job Queue. Job producers enqueue jobs and job consumers dequeue and run them. Imagine your intern project is to build the next version of Job Queue. You want to automatically prune the queue by removing duplicates (identical jobs). However, for debugging purposes you decide to allow one duplicate for each job in the queue. Thus, two instances of the same job are allowed, but third, forth, etc instances should be removed. You still want to preserve the order of jobs in the queue after extra jobs are removed You decide to represent the Job Queue as a doubly-linked list containing integer job ids For example head Since job 1 appears a third time in the list, the third instance should be removed. All other values appear only once or twice, and should stay in the list. With the extra nodes removed, the updated list would be: head Input Format The prune function that you must complete in the editor below takes one parameter head, which references the first LinkedListNode in a doubly-linked list of integers. Output Format The prune function should return the same LinkedListNode that is the first node in the original list. The extra nodes (i.e. the third, forth etc instances of same job) should be removed from the list. You should not create a new list, but should instead modify the existing list

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!